如何自定义勾选颜色机器人在对话框的颜色。 :机器人机器人、颜色、自定义、对话框

由网友(遮云壑)分享简介:如何自定义勾选颜色机器人在对话框的颜色。目前,在默认情况下,复选标记的颜色是绿色的默认。我想将其定义为不同的颜色的选择How to customize the color of the CheckMark color in android in a dialog. Currently , By default, th...

如何自定义勾选颜色机器人在对话框的颜色。目前,在默认情况下,复选标记的颜色是绿色的默认。我想将其定义为不同的颜色的选择

How to customize the color of the CheckMark color in android in a dialog. Currently , By default, the color of the checkmark is green by default. I would like to customize it to a different color of choice

推荐答案

如果你看一下styles.xml从android系统,您将看到复选框类型的定义如下:

If you look at the styles.xml from android system, you will see that the checkbox style is defined as follows :

<style name="Widget.CompoundButton.CheckBox">
   <item name="android:background">@android:drawable/btn_check_label_background</item>
   <item name="android:button">@android:drawable/btn_check</item>
</style>

如果你搜索系统中的资源,你会看到btn_check是绘制选择器2状态(开/关)用彩色绿色或不检查。 所以,如果你想拥有自己的颜色绘制,这里是你应该做的: - 创建一个styles.xml - 定义2可绘制使用 - 创建XML文件配套的选择

And If you search the resources of the system, you will see that btn_check is a drawable selector with 2 states (on/off) with the check colored green or not. So if you want to have your own color-drawable, here is what you should do : - create a styles.xml - define the 2 drawables to use - create the xml file supporting the selector

您可以找到完整的文档非常相关详细的的谷歌Android文档。

You can find the full documentation quite detailled on the android google doc.

阅读全文

相关推荐

最新文章