问题
I try to change background and textcolor of AlertDialog.
But I can change only color of title with android:windowTitleStyle
Activity: AlertDialog.Builder adb = new AlertDialog.Builder(new ContextThemeWrapper(this, R.style.AlertDialogCustom));
styles.xml
style name="AlertDialogCustom" parent="Holo.Theme.Sherlock"
How can I do that? Thanks.
回答1:
adb.setMessage(Html.fromHtml("<font color='#FF0000'><b>John:</b></font>"+"How are you?"))
this is for changing text color You can create you own dialog box check this link http://www.helloandroid.com/tutorials/how-display-custom-dialog-your-android-application
http://developer.android.com/guide/topics/ui/dialogs.html
回答2:
Check this
Android Custom Dialog Example
Custom Dialog Box Popup using Layout in Android
回答3:
try this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AlertDialogCustom" parent="@android:style/AlertDialog">
<item name="android:textColor">#00FF00</item>
<item name="android:background">#0000FF</item>
<item name="android:typeface">monospace</item>
<item name="android:textSize">10sp</item>
</style>
</resources>
来源:https://stackoverflow.com/questions/12938835/change-background-textcolor-of-alertdialog