How to add an Image to a ProgressDialog?
I tried many ways to add an image to a Progress Dialog
Please Help me.
android progressdialog
add a comment |
I tried many ways to add an image to a Progress Dialog
Please Help me.
android progressdialog
1
With inflate custom view.
– Piyush
Nov 19 '18 at 12:13
go for this link, you will get help stackoverflow.com/questions/12115350/…
– Rishav Singla
Nov 19 '18 at 12:25
add a comment |
I tried many ways to add an image to a Progress Dialog
Please Help me.
android progressdialog
I tried many ways to add an image to a Progress Dialog
Please Help me.
android progressdialog
android progressdialog
edited Nov 19 '18 at 12:20
Fantômas
32.6k156388
32.6k156388
asked Nov 19 '18 at 12:12
ChathuraChathura
1146
1146
1
With inflate custom view.
– Piyush
Nov 19 '18 at 12:13
go for this link, you will get help stackoverflow.com/questions/12115350/…
– Rishav Singla
Nov 19 '18 at 12:25
add a comment |
1
With inflate custom view.
– Piyush
Nov 19 '18 at 12:13
go for this link, you will get help stackoverflow.com/questions/12115350/…
– Rishav Singla
Nov 19 '18 at 12:25
1
1
With inflate custom view.
– Piyush
Nov 19 '18 at 12:13
With inflate custom view.
– Piyush
Nov 19 '18 at 12:13
go for this link, you will get help stackoverflow.com/questions/12115350/…
– Rishav Singla
Nov 19 '18 at 12:25
go for this link, you will get help stackoverflow.com/questions/12115350/…
– Rishav Singla
Nov 19 '18 at 12:25
add a comment |
2 Answers
2
active
oldest
votes
Try This Code
Dialog dialog = new Dialog(MainActivity.this);
dialog.setContentView(R.layout.custom_dialog_lay);
//dialog.setTitle("Progress");
TextView text = (TextView) dialog.findViewById(R.id.text);
text.setText("Loading... ");
ImageView image = (ImageView) dialog.findViewById(R.id.image);
image.setImageResource(R.drawable.android);
custom_dialog_lay.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_root"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp"
>
<ImageView android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
/>
<TextView android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textColor="#FFF"
/>
<ImageView android:id="@+id/img"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/sms_ic"
/>
Yes..!! it's Worked for me..!! but Could you please tell me how to remove title of the dialog..?
– Chathura
Nov 19 '18 at 12:51
1
@Chathura remove or comment this Linedialog.setTitle("Progress");
– Sniffer
Nov 19 '18 at 12:52
when comment this line Title not showing but it's space still there..!! how to remove it..!
– Chathura
Nov 20 '18 at 2:59
How to include animating Gif image instead of this png..!!
– Chathura
Nov 20 '18 at 3:08
@Chathura you can try Picasso or Glide library Check this answer
– Sniffer
Nov 20 '18 at 4:55
add a comment |
Insert a layout which will hold the progressbar, text and imageview inside your layout like it is done below:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.v7.widget.RecyclerView
android:id="@+id/recipe_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.example.android.bakingapp.MainActivity"/>
<LinearLayout
android:id="@+id/dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_gravity="center"
android:orientation="horizontal">
<ProgressBar
android:id="@+id/progress_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_gravity="center"
android:textColor="@color/colorAccent"
android:layout_margin="20dp"
android:textSize="30sp"/>
<TextView
android:id="@+id/loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_gravity="center"
android:textColor="@color/colorAccent"
android:text="Loading..."
android:textSize="20sp"
android:layout_margin="20dp"/>
<ImageView.../>
</LinearLayout>
</FrameLayout>
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53374401%2fhow-to-add-an-image-to-a-progressdialog%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try This Code
Dialog dialog = new Dialog(MainActivity.this);
dialog.setContentView(R.layout.custom_dialog_lay);
//dialog.setTitle("Progress");
TextView text = (TextView) dialog.findViewById(R.id.text);
text.setText("Loading... ");
ImageView image = (ImageView) dialog.findViewById(R.id.image);
image.setImageResource(R.drawable.android);
custom_dialog_lay.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_root"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp"
>
<ImageView android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
/>
<TextView android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textColor="#FFF"
/>
<ImageView android:id="@+id/img"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/sms_ic"
/>
Yes..!! it's Worked for me..!! but Could you please tell me how to remove title of the dialog..?
– Chathura
Nov 19 '18 at 12:51
1
@Chathura remove or comment this Linedialog.setTitle("Progress");
– Sniffer
Nov 19 '18 at 12:52
when comment this line Title not showing but it's space still there..!! how to remove it..!
– Chathura
Nov 20 '18 at 2:59
How to include animating Gif image instead of this png..!!
– Chathura
Nov 20 '18 at 3:08
@Chathura you can try Picasso or Glide library Check this answer
– Sniffer
Nov 20 '18 at 4:55
add a comment |
Try This Code
Dialog dialog = new Dialog(MainActivity.this);
dialog.setContentView(R.layout.custom_dialog_lay);
//dialog.setTitle("Progress");
TextView text = (TextView) dialog.findViewById(R.id.text);
text.setText("Loading... ");
ImageView image = (ImageView) dialog.findViewById(R.id.image);
image.setImageResource(R.drawable.android);
custom_dialog_lay.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_root"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp"
>
<ImageView android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
/>
<TextView android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textColor="#FFF"
/>
<ImageView android:id="@+id/img"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/sms_ic"
/>
Yes..!! it's Worked for me..!! but Could you please tell me how to remove title of the dialog..?
– Chathura
Nov 19 '18 at 12:51
1
@Chathura remove or comment this Linedialog.setTitle("Progress");
– Sniffer
Nov 19 '18 at 12:52
when comment this line Title not showing but it's space still there..!! how to remove it..!
– Chathura
Nov 20 '18 at 2:59
How to include animating Gif image instead of this png..!!
– Chathura
Nov 20 '18 at 3:08
@Chathura you can try Picasso or Glide library Check this answer
– Sniffer
Nov 20 '18 at 4:55
add a comment |
Try This Code
Dialog dialog = new Dialog(MainActivity.this);
dialog.setContentView(R.layout.custom_dialog_lay);
//dialog.setTitle("Progress");
TextView text = (TextView) dialog.findViewById(R.id.text);
text.setText("Loading... ");
ImageView image = (ImageView) dialog.findViewById(R.id.image);
image.setImageResource(R.drawable.android);
custom_dialog_lay.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_root"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp"
>
<ImageView android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
/>
<TextView android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textColor="#FFF"
/>
<ImageView android:id="@+id/img"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/sms_ic"
/>
Try This Code
Dialog dialog = new Dialog(MainActivity.this);
dialog.setContentView(R.layout.custom_dialog_lay);
//dialog.setTitle("Progress");
TextView text = (TextView) dialog.findViewById(R.id.text);
text.setText("Loading... ");
ImageView image = (ImageView) dialog.findViewById(R.id.image);
image.setImageResource(R.drawable.android);
custom_dialog_lay.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_root"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp"
>
<ImageView android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="10dp"
/>
<TextView android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textColor="#FFF"
/>
<ImageView android:id="@+id/img"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/sms_ic"
/>
edited Nov 19 '18 at 12:57
answered Nov 19 '18 at 12:21
SnifferSniffer
7081722
7081722
Yes..!! it's Worked for me..!! but Could you please tell me how to remove title of the dialog..?
– Chathura
Nov 19 '18 at 12:51
1
@Chathura remove or comment this Linedialog.setTitle("Progress");
– Sniffer
Nov 19 '18 at 12:52
when comment this line Title not showing but it's space still there..!! how to remove it..!
– Chathura
Nov 20 '18 at 2:59
How to include animating Gif image instead of this png..!!
– Chathura
Nov 20 '18 at 3:08
@Chathura you can try Picasso or Glide library Check this answer
– Sniffer
Nov 20 '18 at 4:55
add a comment |
Yes..!! it's Worked for me..!! but Could you please tell me how to remove title of the dialog..?
– Chathura
Nov 19 '18 at 12:51
1
@Chathura remove or comment this Linedialog.setTitle("Progress");
– Sniffer
Nov 19 '18 at 12:52
when comment this line Title not showing but it's space still there..!! how to remove it..!
– Chathura
Nov 20 '18 at 2:59
How to include animating Gif image instead of this png..!!
– Chathura
Nov 20 '18 at 3:08
@Chathura you can try Picasso or Glide library Check this answer
– Sniffer
Nov 20 '18 at 4:55
Yes..!! it's Worked for me..!! but Could you please tell me how to remove title of the dialog..?
– Chathura
Nov 19 '18 at 12:51
Yes..!! it's Worked for me..!! but Could you please tell me how to remove title of the dialog..?
– Chathura
Nov 19 '18 at 12:51
1
1
@Chathura remove or comment this Line
dialog.setTitle("Progress");
– Sniffer
Nov 19 '18 at 12:52
@Chathura remove or comment this Line
dialog.setTitle("Progress");
– Sniffer
Nov 19 '18 at 12:52
when comment this line Title not showing but it's space still there..!! how to remove it..!
– Chathura
Nov 20 '18 at 2:59
when comment this line Title not showing but it's space still there..!! how to remove it..!
– Chathura
Nov 20 '18 at 2:59
How to include animating Gif image instead of this png..!!
– Chathura
Nov 20 '18 at 3:08
How to include animating Gif image instead of this png..!!
– Chathura
Nov 20 '18 at 3:08
@Chathura you can try Picasso or Glide library Check this answer
– Sniffer
Nov 20 '18 at 4:55
@Chathura you can try Picasso or Glide library Check this answer
– Sniffer
Nov 20 '18 at 4:55
add a comment |
Insert a layout which will hold the progressbar, text and imageview inside your layout like it is done below:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.v7.widget.RecyclerView
android:id="@+id/recipe_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.example.android.bakingapp.MainActivity"/>
<LinearLayout
android:id="@+id/dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_gravity="center"
android:orientation="horizontal">
<ProgressBar
android:id="@+id/progress_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_gravity="center"
android:textColor="@color/colorAccent"
android:layout_margin="20dp"
android:textSize="30sp"/>
<TextView
android:id="@+id/loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_gravity="center"
android:textColor="@color/colorAccent"
android:text="Loading..."
android:textSize="20sp"
android:layout_margin="20dp"/>
<ImageView.../>
</LinearLayout>
</FrameLayout>
add a comment |
Insert a layout which will hold the progressbar, text and imageview inside your layout like it is done below:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.v7.widget.RecyclerView
android:id="@+id/recipe_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.example.android.bakingapp.MainActivity"/>
<LinearLayout
android:id="@+id/dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_gravity="center"
android:orientation="horizontal">
<ProgressBar
android:id="@+id/progress_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_gravity="center"
android:textColor="@color/colorAccent"
android:layout_margin="20dp"
android:textSize="30sp"/>
<TextView
android:id="@+id/loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_gravity="center"
android:textColor="@color/colorAccent"
android:text="Loading..."
android:textSize="20sp"
android:layout_margin="20dp"/>
<ImageView.../>
</LinearLayout>
</FrameLayout>
add a comment |
Insert a layout which will hold the progressbar, text and imageview inside your layout like it is done below:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.v7.widget.RecyclerView
android:id="@+id/recipe_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.example.android.bakingapp.MainActivity"/>
<LinearLayout
android:id="@+id/dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_gravity="center"
android:orientation="horizontal">
<ProgressBar
android:id="@+id/progress_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_gravity="center"
android:textColor="@color/colorAccent"
android:layout_margin="20dp"
android:textSize="30sp"/>
<TextView
android:id="@+id/loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_gravity="center"
android:textColor="@color/colorAccent"
android:text="Loading..."
android:textSize="20sp"
android:layout_margin="20dp"/>
<ImageView.../>
</LinearLayout>
</FrameLayout>
Insert a layout which will hold the progressbar, text and imageview inside your layout like it is done below:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.v7.widget.RecyclerView
android:id="@+id/recipe_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.example.android.bakingapp.MainActivity"/>
<LinearLayout
android:id="@+id/dialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_gravity="center"
android:orientation="horizontal">
<ProgressBar
android:id="@+id/progress_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_gravity="center"
android:textColor="@color/colorAccent"
android:layout_margin="20dp"
android:textSize="30sp"/>
<TextView
android:id="@+id/loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_gravity="center"
android:textColor="@color/colorAccent"
android:text="Loading..."
android:textSize="20sp"
android:layout_margin="20dp"/>
<ImageView.../>
</LinearLayout>
</FrameLayout>
answered Nov 19 '18 at 12:24
Show Young SoyinkaShow Young Soyinka
34119
34119
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53374401%2fhow-to-add-an-image-to-a-progressdialog%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
With inflate custom view.
– Piyush
Nov 19 '18 at 12:13
go for this link, you will get help stackoverflow.com/questions/12115350/…
– Rishav Singla
Nov 19 '18 at 12:25