LittleFunny
LittleFunny

Reputation: 8405

Android: Having a custom Theme on whole application

I have a theme which have set as yellow background and assigned to application level in the manifest file. When I try doing custom progress dialog I have a background rectangle yellow. How do I overcome with this.

Upvotes: 0

Views: 207

Answers (2)

piotrek1543
piotrek1543

Reputation: 19361

I've founded a topic on StackOverflow, which might be very useful for you:

Change style of ProgressDialog

There you would find this answer

You can style your progress dialog this way: create a drawable file with your ring shape (circular_progress_dialog)

<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 set your style with

myProgressDialog.setProgressStyle(R.style.ProgressBar)

If it's not satisfying you, read also:

Custom progressdialog in android created dynamically

How to customize the Progress Dialog in Android

Hope it help

Upvotes: 1

Gonzalo
Gonzalo

Reputation: 1876

Create a new theme for dialogs where you change the background. Then use the Dialog constructor passing the style.

<style name="Dialog" parent="@style/AppTheme">
    <item name="android:backgroundColor">#000000</item>
</style>

Create the dialog like this.

new Dialog(context, R.style.Dialog);

Upvotes: 0

Related Questions