I want to style all the android.app.ProgressDialog
s in my app on pre-Lollipop versions to make them look like Material Design.
Maybe I'm missing something obvious: I'm looking for android.support.v7.app.ProgressDialog
, but there is no such class in Android AppCompat library.
Should I write my own implementation of ProgressDialog
from scratch? What is the reason it's not included in AppCompat library?
ProgressDialog 's look can be replicated by placing a ProgressBar into an AlertDialog . You can still use it, but Android does not want you to use it, that is why it is deprecated.
Android ProgressDialog is a dialog box/dialog window which shows the progress of a task. Android Progress Dialog is almost same as ProgressBar with the exception that this is displayed as a dialog box. In order to create a ProgressDialog to display a ProgressBar we need to instantiate it like this.
In order to do this, you need to instantiate an object of this class. Its syntax is. ProgressDialog progress = new ProgressDialog(this); Now you can set some properties of this dialog.
Widget.AppCompat.*
styles can be used starting from API 7.
There is currently no AppCompat style for the progress dialog since it relies on AnimatedVectorDrawable.
However, it's possible to write a custom drawable
that has the same behavior and apply it to your ProgressDialog
.
check out GIT
You can use other cool compatibility libraries besides AppCompat. There are cool libraries which brings fully animated Material Design components to pre-Lolipop Android on Github. The images are from Rey5137's "Material" library. You better use one of such libraries rather that writing from scratch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With