AlertDialog背景的修改
AlertDialog背景的修改是不允许使用xml的去修改的
如果你是用
<style name="MyOpaqueActivity" parent="@android:style/Theme.Dialog">?
? ? <item name="android:windowBackground">@drawable/my_background</item>?
? ? <item name="android:alertDialogStyle">@style/MyOpaqueAlertDialog</item>?
</style>?
?
<style name="MyOpaqueAlertDialog" parent="@android:style/Theme.Dialog.Alert">?
? ? <item name="android:background">#454545</item>?
? ? <item name="android:windowBackground">@drawable/my_background</item>?
? ? <item name="android:popupBackground">@drawable/my_background</item>?
</style>?
然后应用到你的整个程序中你会发现 背景色改了my_background起作用了,但是MyOpaqueAlertDialog不能起作用
也就是说AlertDialog不能在xml中该
只能硬编码
protected AlertDialog(Context context) {?
? ? this(context, com.android.internal.R.style.Theme_Dialog_Alert);?
}?
?
public Builder(Context context) {?
? ? this(context, com.android.internal.R.style.Theme_Dialog_Alert);?
}?