改变Android中默认Dialog的样式
2017-01-04 15:20
239 查看
Android中默认的Dialog是黑白色的,有点丑啊!
在清单文件中application的标签属性中theme,默认的是:
默认Dialog的代码:
默认的Dialog是这样的:
是不是很丑啊!
如果我们想改变默认Dialog的样式,可以重新定义style
在application中引用
效果是这样的:
是不是清爽很多!!
在清单文件中application的标签属性中theme,默认的是:
android:theme="@style/AppTheme"
<style name="AppTheme" parent="android:Theme.Light"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> </style>
默认Dialog的代码:
AlertDialog.Builder builder = new AlertDialog.Builder(ShopsDetailActivity.this); builder.setMessage("是否退出当前绑定的社区店?"); builder.setTitle("来米汇"); builder.setPositiveButton("是", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //清空表中所有记录 SQLdb.execSQL("DELETE FROM picturetable"); finish(); } }); builder.setNegativeButton("否", null); builder.show();
默认的Dialog是这样的:
是不是很丑啊!
如果我们想改变默认Dialog的样式,可以重新定义style
<style name="customHoloLight" parent="@android:style/Theme.Holo.Light"> <item name="android:windowNoTitle">true</item> </style>
在application中引用
android:theme="@style/customHoloLight"
效果是这样的:
是不是清爽很多!!
相关文章推荐
- android dialog和activity 改变出现消失的 动画样式
- (android UI )shape详解,改变控件的默认样式(GradientDrawable)
- 不改变默认布局样式让Android系统默认的标题栏消失
- 如何改变Android Progressbar默认颜色
- 改变Android屏幕默认启动方向为横向
- 如何改变Android Progressbar默认颜色
- Android-自定义Dialog样式
- android的无标题dialog以及dialog样式的窗体
- android如何改变默认横竖屏方向
- 如何改变Android Progressbar默认颜色
- 改变flex默认的提示样式
- android 改变 listView gridView的默认点击效果
- OpenFileDialog会改变FileInfo的默认路径吗?
- android dialog 背景透明的样式
- Android 如何修改默认的Tab样式
- android 下改变默认的checkbox的 选中 和被选中 图片
- powerDesigner改变外键连接的默认样式
- Flex中如何利用folderOpenIcon, folderClosedIcon和defaultLeafIcon样式改变默认文件夹和子项目图标的例子
- Android 自定义Dialog样式
- Android中如何修改SeekBar的默认样式