设置警报对话框的标题背景颜色,而无需创建自定义对话框 [英] Set the title background color of alert dialog without making a custome dialog

查看:91
本文介绍了设置警报对话框的标题背景颜色,而无需创建自定义对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用警报对话框生成器,我想更改默认警报对话框标题的背景色.我已经对其进行了搜索(但是找不到我想要的).事实是,我不想创建自定义对话框并扩展它,因为我想使用警报对话框的现有功能(设置项目列表..etc).

I am using the alert dialog builder and I would like to change the default alert dialog title background color. I have done searches on it (but couldnt find what I want). The thing is that I don't want to create custom dialog and extend it as I want to use the existing functionality of alert dialog (setting items list ..etc).

无论如何,我是否可以设置标题背景颜色而不必创建自定义对话框/向其添加视图.等?

Is there anyway I can set the title background color without having to create a custom dialog/add views to it .etc?

非常感谢您

推荐答案

您可以使用 setCustomTitle(view)

LayoutInflater inflater = getLayoutInflater();
View view=inflater.inflate(R.layout.custom_view, null);
alert.setCustomTitle(view);

这篇关于设置警报对话框的标题背景颜色,而无需创建自定义对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆