AlertDialog自定义样式

论坛 期权论坛 编程之家     
选择匿名的用户   2021-6-2 16:32   703   0

像列表这种选择项的弹出式对话框,要改变样式一般都采取重写layout方式


今天才了解到 其实可以自定义样式,与大家分享下,其实很简单


AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(this, R.style.AlertDialogCustom));

然后自定义自己的样式就可以了


<?xml version="1.0" encoding="utf-8"?> <resources> <style name="AlertDialogCustom" parent="@android:style/AlertDialog"> <item name="android:textColor">#00FF00</item> <item name="android:typeface">monospace</item> <item name="android:textSize">10sp</item> </style> </resources>

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP