当前位置:操作系统 > 安卓/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>   

摘自:独自登高楼 望断天涯路

补充:移动开发 , Android ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,