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);
}
更多相关文章
- Android(安卓)Studio(七):项目从Eclipse到Android(安卓)Studio迁
- android 中遥控器键值的添加和修改
- Android(安卓)settings使用详解之设置优先网络
- android textview 自动链接网址 修改默认点击事件
- android RatingBar自定义图片
- Android修改Gallery页面布局
- Spinner控件的使用
- Android(安卓)底部虚拟按键颜色修改
- android地图定位