Using custom ProgressDialog android


I am using custom ProgressDialog in my application, I am able to make it custom but I also want to remove the upper border or window of progressDialog. In styles.xml I define customDialog as

<style name="AppTheme" parent="android:Theme.Light" />

<style name="CustomDialog" parent="@android:style/Theme.Dialog">
    <item name="android:background">#7BC047</item>
    <item name="android:textColor">#FFFFFF</item>
    <item name="android:windowBackground">@null</item>
     <item name="android:windowFrame">@null</item>
</style>

For removing the parent window I am setting windowBackground to null and windowFrame to null but it did't work for me. Currently my custom progress dialog look like that in the image given belowenter image description here

I am using this code to set the style of progressDialog.

 private void showProgressDialog() {
    progressDialog = new ProgressDialog(this,R.style.CustomDialog);
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progressDialog.setMessage("Logging in. Please wait.");
    progressDialog.show();
}

So,help me regarding this issue any help should be really appreciated.


Answers:


This answer does not address the problem stated in the question, but when searching for how to implement a custom progress dialog, this is the only link pointing to SO. That said, I found a cool and easy-to -use custom progress dialog by a certain Maksym Dybarskyi on this link.

All Credit goes to the creator, not me.Am just sharing

All you need to do is add this to your dependencies:

dependencies {
...
   compile 'com.github.d-max:spots-dialog:[email protected]'
}

And then the custom style:

<style name="Custom" parent="android:Theme.DeviceDefault.Dialog">
    <item name="DialogTitleAppearance">@android:style/TextAppearance.Medium</item>
    <item name="DialogTitleText">Please Wait</item>
    <item name="DialogSpotColor">@android:color/holo_orange_dark</item>
    <item name="DialogSpotCount">8</item>
</style>

Finally, in your code do this:

private AlertDialog progressDialog;
progressDialog = new SpotsDialog(mContext, R.style.Custom);

//Am using it in an AsyncTask. So in  my onPreExecute, I do this:
public void onPreExecute() {
  super.onPreExecute();
  progressDialog.show();
  ...
 }

//dismiss in onPostExecute
public void onPostExecute(){
   progressDialog.dismiss();
 } 

Result:

enter image description here

The yellow dots move from left to right and you can change the number of dots in styles