软件编程
位置:首页>> 软件编程>> Android编程>> Android AlertDialog自定义样式实现代码

Android AlertDialog自定义样式实现代码

作者:吴冬冬  发布时间:2023-07-08 13:10:06 

标签:AlertDialog,android,自定义

Android AlertDialog自定义样式

像列表这种选择项的弹出式对话框,要改变样式一般都采取重写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
投稿

猜你喜欢

手机版 软件编程 asp之家 www.aspxhome.com