您的位置:首页 > 其它

自定义 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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: