android studio复选按钮样式,Android主题更改复选框项目文本颜色

How do I just change the text color of checkbox views in Android Studio's styles.xml?

I want to create a theme where all checkbox items are a color different from the default black like:

119f0d97d3fd731ed0e03c4e8cf4ce1c.png

Except I want the box itself to be the same color as the text.

Should I be using the following in my theme?

@style/App_CheckboxStyle

解决方案

I know that this question is asked long time ago but I want to add my solution. It works with all SDK versions.

You are right that in order to change CheckBox style in the whole project, you have to add the line to your theme:

...

@style/MyCheckBoxStyle

...

And the style itself, where you set your custom text and checkbox color:

@android:color/holo_purple

@android:color/holo_purple

Note: android: prefix indicates that a property is linked to SDK attributes. If you remove it, the property links to support library. That's why system treats buttonTint and android:buttonTint as different parameters. If your minimum SDK is 21, you don't need to use support library and you can simply use android:buttonTint.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值