I've breaking my head over this quite a bit. What I need to do is, change the style of all AlertDialog
s in my android application - dialog background needs to be white-ish, and text needs to be black-ish. I tried creating a lot of styles, themes, and applying from the code, manifest, etc, but no success, with regard to the text colors inside the AlertDialog
. Right now, I have the simplest of codes, set like this:
Manifest:
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
styles.xml:
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:alertDialogStyle">@style/DialogStyle</item>
</style>
<style name="DialogStyle" parent="@android:style/Theme.Dialog">
<!-- changing these background stuff works fine -->
<item name="android:bottomBright">@android:color/white</item>
<item name="android:bottomDark">@android:color/white</item>
<item name="android:bottomMedium">@drawable/dialog_footer_bg</item>
<item name="android:centerBright">@android:color/white</item>
<item name="android:centerDark">@drawable/dialog_body_bg</item>
<item name="android:centerMedium">@android:color/white</item>
<item name="android:fullBright">@color/orange</item>
<item name="android:fullDark">@color/orange</item>
<item name="android:topBright">@color/green</item>
<item name="android:topDark">@drawable/dialog_header_bg</item>
The items listed below don't work (please read the comments I've put above each element):
<!-- panelBackground is not getting set to null, there is something squarish around it -->
<item name="android:panelBackground">@null</item>
<!-- Setting this textColor doesn't seem to have any effect at all. Messages, title, button text color, whatever; nothing changes. -->
<item name="android:textColor">#000000</item>
<!-- Also tried with textAppearance, as follows. Didn't work -->
<item name="android:textAppearance">?android:attr/textColorPrimaryInverse</item>
<!-- Also tried changing textAppearancePrimary, to no avail -->
<item name="android:textColorPrimary">#000000</item>
<!-- Also need to change the dialog title text, tried it as follows, dint work: -->
<item name="android:windowTitleStyle">@style/DialogWindowTitle</item>
</style>
The DialogWindowTitle is defined as follows:
<style name="DialogWindowTitle">
<item name="android:textAppearance">?android:attr/textAppearanceMediumInverse</item>
</style>
So none of these is working. Can anyone tell me what I could be doing wrong, and how can I:
- Change text color for messages (content text)
- Change title text color
- Remove the
panel background
Note: I need to support API 8 (2.2) upwards. Also, I've went through most of the related question here, and google groups, but can't figure out, though I have a feeling its right under my nose!
Edit: adding screenshot:
See Question&Answers more detail:
os