自定义 AlertDialog 主题的方法
2017-02-20 15:48
288 查看
由于 AlertDialog 不需要在 Manifests 中注册,所以无法再 Manifests 文件中定义起主题,那么该如何自定义 AlertDialog 的主题呢,事实上可以在创建 AlertDialog 的时候指定它的主题:
AlertDialog dialog = new AlertDialog.Builder(new ContextThemeWrapper(context, R.style.MyDialogStyle)).create();
<style name="MyDialogStyle" parent="AlertDialog.AppCompat.Light">
<item name="android:background">@color/my_dialog_background</item>
</style>
AlertDialog dialog = new AlertDialog.Builder(new ContextThemeWrapper(context, R.style.MyDialogStyle)).create();
<style name="MyDialogStyle" parent="AlertDialog.AppCompat.Light">
<item name="android:background">@color/my_dialog_background</item>
</style>
相关文章推荐
- SharePoint【学习笔记】-- 自定义 SharePoint 2010 的配色主题的几种方法
- Android之自定义AlertDialog的实现方法(一)
- 自定义程序的主题的方法:
- alertDialog设立主题theme的方法
- 214_最简单的自定义AlertDialog方法
- AlertDialog 加载自定义布局点击按钮消失的方法
- Vue的elementUI实现自定义主题方法
- Android 自定义AlertDialog,调用方法与系统一致
- 自定义AlertDialog主题
- Android AlertDialog 自定义样式-出现-清除黑边白边主题底色 V7库
- wordpress主题支持自定义菜单及修改css样式实现方法
- AlertDialog 自定义布局点击按钮消失方法
- Android编程自定义AlertDialog样式的方法详解
- 自定义 SharePoint 2010 的配色主题的几种方法
- Android自定义AlertDialog去掉黑边的方法
- 自定义AlertDialog去除黑色背景的解决方法
- 自定义view的构造方法和样式主题
- DataGrid自定义分页以及几种常用的删除方法
- .NET中目录复制方法——自定义函数directoryCopy
- C#的WinForm程序应用了XP主题样式之后,ShowDialog方法出现问题的解决