How to add an Image to a ProgressDialog?











up vote
-1
down vote

favorite












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 at 12:13












  • go for this link, you will get help stackoverflow.com/questions/12115350/…
    – Rishav Singla
    Nov 19 at 12:25















up vote
-1
down vote

favorite












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 at 12:13












  • go for this link, you will get help stackoverflow.com/questions/12115350/…
    – Rishav Singla
    Nov 19 at 12:25













up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











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 at 12:20









Kling Klang

32.1k156287




32.1k156287










asked Nov 19 at 12:12









Chathura

1146




1146








  • 1




    With inflate custom view.
    – Piyush
    Nov 19 at 12:13












  • go for this link, you will get help stackoverflow.com/questions/12115350/…
    – Rishav Singla
    Nov 19 at 12:25














  • 1




    With inflate custom view.
    – Piyush
    Nov 19 at 12:13












  • go for this link, you will get help stackoverflow.com/questions/12115350/…
    – Rishav Singla
    Nov 19 at 12:25








1




1




With inflate custom view.
– Piyush
Nov 19 at 12:13






With inflate custom view.
– Piyush
Nov 19 at 12:13














go for this link, you will get help stackoverflow.com/questions/12115350/…
– Rishav Singla
Nov 19 at 12:25




go for this link, you will get help stackoverflow.com/questions/12115350/…
– Rishav Singla
Nov 19 at 12:25












2 Answers
2






active

oldest

votes

















up vote
1
down vote



accepted










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 at 12:51






  • 1




    @Chathura remove or comment this Line dialog.setTitle("Progress");
    – Sniffer
    Nov 19 at 12:52










  • when comment this line Title not showing but it's space still there..!! how to remove it..!
    – Chathura
    2 days ago










  • How to include animating Gif image instead of this png..!!
    – Chathura
    2 days ago












  • @Chathura you can try Picasso or Glide library Check this answer
    – Sniffer
    2 days ago


















up vote
1
down vote













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








    up vote
    1
    down vote



    accepted










    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 at 12:51






    • 1




      @Chathura remove or comment this Line dialog.setTitle("Progress");
      – Sniffer
      Nov 19 at 12:52










    • when comment this line Title not showing but it's space still there..!! how to remove it..!
      – Chathura
      2 days ago










    • How to include animating Gif image instead of this png..!!
      – Chathura
      2 days ago












    • @Chathura you can try Picasso or Glide library Check this answer
      – Sniffer
      2 days ago















    up vote
    1
    down vote



    accepted










    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 at 12:51






    • 1




      @Chathura remove or comment this Line dialog.setTitle("Progress");
      – Sniffer
      Nov 19 at 12:52










    • when comment this line Title not showing but it's space still there..!! how to remove it..!
      – Chathura
      2 days ago










    • How to include animating Gif image instead of this png..!!
      – Chathura
      2 days ago












    • @Chathura you can try Picasso or Glide library Check this answer
      – Sniffer
      2 days ago













    up vote
    1
    down vote



    accepted







    up vote
    1
    down vote



    accepted






    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 at 12:57

























    answered Nov 19 at 12:21









    Sniffer

    6331721




    6331721












    • Yes..!! it's Worked for me..!! but Could you please tell me how to remove title of the dialog..?
      – Chathura
      Nov 19 at 12:51






    • 1




      @Chathura remove or comment this Line dialog.setTitle("Progress");
      – Sniffer
      Nov 19 at 12:52










    • when comment this line Title not showing but it's space still there..!! how to remove it..!
      – Chathura
      2 days ago










    • How to include animating Gif image instead of this png..!!
      – Chathura
      2 days ago












    • @Chathura you can try Picasso or Glide library Check this answer
      – Sniffer
      2 days ago


















    • Yes..!! it's Worked for me..!! but Could you please tell me how to remove title of the dialog..?
      – Chathura
      Nov 19 at 12:51






    • 1




      @Chathura remove or comment this Line dialog.setTitle("Progress");
      – Sniffer
      Nov 19 at 12:52










    • when comment this line Title not showing but it's space still there..!! how to remove it..!
      – Chathura
      2 days ago










    • How to include animating Gif image instead of this png..!!
      – Chathura
      2 days ago












    • @Chathura you can try Picasso or Glide library Check this answer
      – Sniffer
      2 days ago
















    Yes..!! it's Worked for me..!! but Could you please tell me how to remove title of the dialog..?
    – Chathura
    Nov 19 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 at 12:51




    1




    1




    @Chathura remove or comment this Line dialog.setTitle("Progress");
    – Sniffer
    Nov 19 at 12:52




    @Chathura remove or comment this Line dialog.setTitle("Progress");
    – Sniffer
    Nov 19 at 12:52












    when comment this line Title not showing but it's space still there..!! how to remove it..!
    – Chathura
    2 days ago




    when comment this line Title not showing but it's space still there..!! how to remove it..!
    – Chathura
    2 days ago












    How to include animating Gif image instead of this png..!!
    – Chathura
    2 days ago






    How to include animating Gif image instead of this png..!!
    – Chathura
    2 days ago














    @Chathura you can try Picasso or Glide library Check this answer
    – Sniffer
    2 days ago




    @Chathura you can try Picasso or Glide library Check this answer
    – Sniffer
    2 days ago












    up vote
    1
    down vote













    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

























      up vote
      1
      down vote













      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























        up vote
        1
        down vote










        up vote
        1
        down vote









        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 at 12:24









        Show Young Soyinka

        34119




        34119






























             

            draft saved


            draft discarded



















































             


            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

            android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

            SQL update select statement

            WPF add header to Image with URL pettitions [duplicate]