Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 920109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:39:20+00:00 2026-05-15T18:39:20+00:00

When calling progressDialog = ProgressDialog.show(this, null, null, true); usually the developers wants to only

  • 0

When calling progressDialog = ProgressDialog.show(this, null, null, true); usually the developers wants to only show the progress indication image, and usually would it expect to be centered within the window (at least from regular UI design point of view).
But the image is too far left, it seems that some padding/margin on the right hand side is still being calculated in for (optional) text on the right, although we’re not passing any text as parameter.
It would just make life little easier for a developer 🙂 So we don’t need to create a custom dialog only in order to have the progress indicator being centered by default.

(I filed this as a feature request at http://code.google.com/p/android/issues/detail?id=9697; please star it if you would also like to see this improved).

Now my questions:

  1. How can I easily center the progress image without having to entirely create my own custom alert dialog class? Any parameter I might have overlooked?

  2. Furthermore, how to set the background to transparent?

I’m also wondering about this:
https://stackoverflow.com/questions/2866141/how-to-put-custom-animation-into-a-progressdialog
I haven’t actually tried it myself yet but if you cannot create custom animations, it means if you want a kind of animated progress indicator, you always need to extend the ProgressDialog class?
Looking at the ProgressDialog class though, I don’t find anything other than regular drawables though (ProgressDialog.java), they’re not using AnimatedDrawable there.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T18:39:21+00:00Added an answer on May 15, 2026 at 6:39 pm

    I did some testing and I feel that the best way to achieve this is doing a custom Dialog.

    Here is an example of what I did. This will answer question number 2 but will give you an idea of how to fix question number 1.

    public class MyProgressDialog extends Dialog {
    
        public static MyProgressDialog show(Context context, CharSequence title,
                CharSequence message) {
            return show(context, title, message, false);
        }
    
        public static MyProgressDialog show(Context context, CharSequence title,
                CharSequence message, boolean indeterminate) {
            return show(context, title, message, indeterminate, false, null);
        }
    
        public static MyProgressDialog show(Context context, CharSequence title,
                CharSequence message, boolean indeterminate, boolean cancelable) {
            return show(context, title, message, indeterminate, cancelable, null);
        }
    
        public static MyProgressDialog show(Context context, CharSequence title,
                CharSequence message, boolean indeterminate,
                boolean cancelable, OnCancelListener cancelListener) {
            MyProgressDialog dialog = new MyProgressDialog(context);
            dialog.setTitle(title);
            dialog.setCancelable(cancelable);
            dialog.setOnCancelListener(cancelListener);
            /* The next line will add the ProgressBar to the dialog. */
            dialog.addContentView(new ProgressBar(context), new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
            dialog.show();
    
            return dialog;
        }
    
        public MyProgressDialog(Context context) {
            super(context, R.style.NewDialog);
        }
    }
    

    All the static methods comes from this link, nothing strange, but the magic occurs in the constructor.
    Check that I pass as parameter an style. That style is the following:

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <style name="NewDialog" parent="@android:Theme.Dialog">
            <item name="android:windowFrame">@null</item>
            <item name="android:windowBackground">@android:color/transparent</item>
            <item name="android:windowIsFloating">true</item>
            <item name="android:windowContentOverlay">@null</item>
            <item name="android:windowTitleStyle">@null</item>
            <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
            <item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
            <item name="android:backgroundDimEnabled">false</item>
            <item name="android:background">@android:color/transparent</item>
        </style>
    </resources>
    

    The result of this is a ProgressBar rotating in the center of the screen. Without backgroundDim and without the Dialog box.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 490k
  • Answers 490k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I strongly recommend to always put your name on your… May 16, 2026 at 9:10 am
  • Editorial Team
    Editorial Team added an answer It's a language requirement. inline means that you may have… May 16, 2026 at 9:10 am
  • Editorial Team
    Editorial Team added an answer You will need a someExecutable binary available on the operating… May 16, 2026 at 9:10 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am trying to prevent my application calling the same method twice in the
I'm trying to make an activity that is asked for some result. This result
I'm hoping someone can help with this, as it's driving me absolutely nuts. I
Preface: I know this is an unusual/improper way to do this. I can do
Calling Validate() on an XmlDocument requires passing in a ValidationEventHandler delegate. That event function
I have an application I am creating with a DashboardActivity & a SettingsActivity. On
I'm still plagued by background threading in a WinForm UI. Why? Here are some
The size of the ProgresDialog is too narrow to hold the text that I
What is TApplication.Handle ? Where does it come from? Why does it exist? And

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.