Reputation: 7214
How to change ProgressDialog style in Android? I need to change background color, and text color.
I have my one style in my app, what item I must override to change progress dialog style?
I would like to change style using only xml, without coding. It is possiable?
PS:
I have no progress bar! I have progress dialog. And i would like to change it style using styles and themes, like I changes style for listview, windows backgrounds and etc.
Upvotes: 2
Views: 9839
Reputation: 3879
You can change the theme of the ProgressDialog like this:
ProgressDialog dialog = new ProgressDialog(this, AlertDialog.THEME_HOLO_DARK);
dialog.setTitle("Title");
dialog.setMessage("Message");
dialog.show();
Upvotes: 9
Reputation: 1868
code for custom dialogbar: File under drawable declares the colors of the different states:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<gradient
android:startColor="#000001"
android:centerColor="#0b131e"
android:centerY="0.75"
android:endColor="#0d1522"
android:angle="270"
/>
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<gradient
android:startColor="#234"
android:centerColor="#234"
android:centerY="0.75"
android:endColor="#a24"
android:angle="270"
/>
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<gradient
android:startColor="#144281"
android:centerColor="#0b1f3c"
android:centerY="0.75"
android:endColor="#06101d"
android:angle="270"
/>
</shape>
</clip>
</item>
</layer-list>
Code inside your layout xml:
<ProgressBar android:id="@+id/progressBar"
android:progressDrawable="@drawable/progress_bar_states"
android:layout_width="fill_parent" android:layout_height="8dip"
style="?android:attr/progressBarStyleHorizontal"
android:indeterminateOnly="false"
android:max="100">
</ProgressBar>
Upvotes: 3