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
如果从android系统查看styles.xml,您会看到复选框样式定义如下:
<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>
Run Code Online (Sandbox Code Playgroud)
如果你搜索系统的资源,你会发现btn_check是一个可绘制的选择器,有2个状态(开/关),检查颜色是否为绿色.
因此,如果你想拥有自己的颜色可绘制,那么你应该做的是:
- 创建一个styles.xml
- 定义要使用的2个drawables
- 创建支持选择器的xml文件
你可以在android google doc上找到相当详细的完整文档.
您必须使用修改后的可绘制资源覆盖复选框小部件样式。这是从样式/主题开始的很好的指南http://brainflush.wordpress.com/2009/03/15/understanding-android-themes-and-styles/
| 归档时间: |
|
| 查看次数: |
17126 次 |
| 最近记录: |