Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Dialog Theme for every Dialog

Im using Theme.Holo.Light.DarkActionBar but I dont really like the Light Dialogs/AlertDialogs.

I want to change every Dialog to the dark Holo Dialog.

<style name="CustomDialogTheme" parent="@android:style/Theme.Holo.Dialog">
    <item name="@android:background">#9933CC</item>
    <item name="@android:textColor">#02FA07</item>
</style>

<style name="Holo.Light.DarkActionBar" parent="@android:style/Theme.Holo.Light.DarkActionBar">
    <item name="android:dialogTheme">@style/CustomDialogTheme</item>
    <item name="android:alertDialogStyle">@style/CustomDialogTheme</item>
</style>

Thats what I tried but it has no effect on any Dialogs.

like image 221
TeKo Avatar asked Sep 17 '13 01:09

TeKo


2 Answers

Ok nvm Im stupid its android:alertDialogTheme instead of android:alertDialogStyle. But this messes up the Preference Dialogs, so I just keep using the Light Dialogs.

like image 168
TeKo Avatar answered Oct 29 '22 10:10

TeKo


In AndroidManifest.xml under the application tag, add this line :

android:theme="Holo.Light.DarkActionBar"

The issue is that the styles you're changing android:background and android:textColor are not dialog attributes.

You can see a full list here under Theme.Holo.Dialog on line 1617.

The ones you have to change are probably android:windowBackground and textAppearance

like image 45
f2prateek Avatar answered Oct 29 '22 09:10

f2prateek