Is it possible to change ProgressBar style of progress dialog. If yes, then how can I do it?
Change style of ProgressDialog
Asked Answered
what kind of style do you want....??? –
Recognizance
Quite easy to do this and the code can be found at the <#2774002> –
Fragmentary
Thank you for your quick replies, I just want to change default ProgressBar animation with my custom animation. –
Indication
You should try Googling whatever it is that you are asking about before posting here. See these Google results: 1.Custom Progress Dialog 2. Custom Style Progress Dialog 3. Custom Progress Dialog using Custom Layout [4. Creating Custom Skinny Progress Bar](sherifandroid.blogspot.in/2011/08/creating-skinny –
Omniscient
possible duplicate of custom Progress Dialog in android? –
Woodenhead
#16910458 My Answer: https://mcmap.net/q/689730/-how-to-set-theme-to-progressdialog –
Amand
You can style your progress dialog this way: create a drawable file with your ring shape (circular_progress_dialog.xml)
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="270"
android:toDegrees="270">
<shape
android:innerRadiusRatio="2.5"
android:shape="ring"
android:thickness="2dp"
android:useLevel="true"><!-- this line fixes the issue for lollipop api 21 -->
<gradient
android:angle="0"
android:endColor="@color/main_background"
android:startColor="@color/main_orange"
android:type="sweep"
android:useLevel="false" />
</shape>
</rotate>
one to style your progress bar
<style name="ProgressBar" parent="@android:style/Widget.ProgressBar">
<item name="android:layout_centerHorizontal">true</item>
<item name="android:layout_centerVertical">true</item>
<item name="android:visibility">gone</item>
<item name="android:background">@color/transparency_pleca</item>
<item name="android:indeterminateDrawable">@drawable/circular_progress_dialog</item>
</style>
Notice your "android:indeterminateDrawable" property
Yout can create an instance of ProgressDialog
and add your style with
// create progressDialog
final ProgressDialog myProgressDialog = new ProgressDialog(MyActivity.this);
myProgressDialog.setProgressStyle(R.style.ProgressBar)
myProgressDialog.show();
© 2022 - 2024 — McMap. All rights reserved.