Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android ProgressDialog position issue and do we have Android's ProgressDialog from platform or support library?

I had this ProgressDialog working fine when my device was in 4.4.4 and I was not working on this app recently and device is upgraded to Lillipop mean while. I am not sure if this has caused anything to this issue but just mentioning.

Question 1. ProgressDialog shows on top left of the screen. See the attached pic. And below is the code. Also how to get transparent background ?

        progressDialog = new ProgressDialog(this, android.R.style.Theme_DeviceDefault_Light_Dialog_Alert);
    progressDialog.setTitle(title);
    progressDialog.setMessage(getResources().getString((R.string.progress_please_wait)));
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progressDialog.setIndeterminate(true);
    progressDialog.setCanceledOnTouchOutside(false);
    progressDialog.getWindow().setGravity(Gravity.CENTER);
    progressDialog.show();

enter image description here

Question 2. I have gone through the material design docs and support docs. I could not find but is there any built in Material Designed ProgressDialog. Or we should depend on the libraries like https://github.com/rahatarmanahmed/CircularProgressView. ?

EDIT :
ClarkXP's answer, in fact more relevant, for another question mentioned below:
Question 3. I tried to use the material-dialogs but my gradle has thrown as error "Failed to resolve: compile com.afollestad:material-dialogs:0.8.5.1".

like image 467
cgr Avatar asked Feb 02 '26 12:02

cgr


1 Answers

To show progressDialogs with material design style, I use Material-Dialogs library.

Greetings

UPDATE

The app build.gradle must have the next configuration for repositories and dependencies in the same file:

  1. In Android closure:

    android {    
        compileSdkVersion 23
        buildToolsVersion "23.0.2"
        ...[your configuration]
    }
    
  2. And Repositories/Dependencies closure:

    repositories {
        maven {
            url "https://jitpack.io"
        }   
    }
    dependencies {   
        compile('com.github.afollestad.material-dialogs:core:0.8.5.1@aar'){
            transitive = true
        }
    }
    
like image 100
ClarkXP Avatar answered Feb 04 '26 01:02

ClarkXP