如何配置文本的颜色对话框 [英] How can I configure the color of the text in a dialog

查看:110
本文介绍了如何配置文本的颜色对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android的选择对话框中,像这样的例子,
http://labs.makemachine.net/2010/03/android-多选,对话框/

In android selection dialog, like this example, http://labs.makemachine.net/2010/03/android-multi-selection-dialogs/

我怎样才能具体的对话框中文字的颜色?例如文本火星人的色彩,朱庇特?

How can I specific the color of the text in the dialog? e.g. the color of the text "Mars", "Jupiter"?

推荐答案

如果你只是想更改文本颜色,只是使select_dialog_multichoice XML布局的副本,它的标题你想要的东西(如select_dialog_multichoice_red.xml)和改变文字颜色属性,你想什么来代替。然后使用此XML文件为您的适配器,而不是Android的默认值。

If you just want to change the text color, just make a duplicate of that select_dialog_multichoice XML layout, title it what you want (e.g select_dialog_multichoice_red.xml), and change the textColor attribute to what you would like instead. Then use this XML file for your adapter, instead of the Android default.

如果您是基于变量想要彩色的项目,你需要做的是克里斯蒂安说,创建一个自定义视图。覆盖getView(),然后在那里你可以设置与任何特定的code处理您的颜色选择文本颜色。

If you are wanting items colored based on variables, you would need to do as Cristian said and create a custom View. Override getView(), and then in there you can set the text color with whatever specific code handles your color choice.

这篇关于如何配置文本的颜色对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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