How to add an Image to a ProgressDialog?












-1















enter image description here



I tried many ways to add an image to a Progress Dialog

Please Help me.










share|improve this question




















  • 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















enter image description here



I tried many ways to add an image to a Progress Dialog

Please Help me.










share|improve this question




















  • 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








-1








enter image description here



I tried many ways to add an image to a Progress Dialog

Please Help me.










share|improve this question
















enter image description here



I tried many ways to add an image to a Progress Dialog

Please Help me.







android progressdialog






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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














  • 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












2 Answers
2






active

oldest

votes


















1














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"
/>







share|improve this answer


























  • 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 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











  • 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



















1














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>





share|improve this answer























    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    1














    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"
    />







    share|improve this answer


























    • 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 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











    • 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
















    1














    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"
    />







    share|improve this answer


























    • 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 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











    • 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














    1












    1








    1







    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"
    />







    share|improve this answer















    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"
    />








    share|improve this answer














    share|improve this answer



    share|improve this answer








    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 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











    • 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






    • 1





      @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











    • 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













    1














    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>





    share|improve this answer




























      1














      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>





      share|improve this answer


























        1












        1








        1







        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>





        share|improve this answer













        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>






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 19 '18 at 12:24









        Show Young SoyinkaShow Young Soyinka

        34119




        34119






























            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Guess what letter conforming each word

            Port of Spain

            Run scheduled task as local user group (not BUILTIN)