【问题标题】:How to change CheckBox color in Android如何在 Android 中更改复选框颜色
【发布时间】:2019-04-18 15:52:31
【问题描述】:

我是 Android 开发新手,我正在关注 this 教程,以在 Android 中展示 CheckboxCheckbox 正确显示。

但我想更改复选框颜色。我该怎么做?

【问题讨论】:

    标签: android checkbox


    【解决方案1】:

    您可以在不使用 buttonTint 更改可绘制对象的情况下执行此操作(从 API 23 开始):

    <CheckBox
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:buttonTint="@color/CHECKMARK_COLOR_HERE" />
    

    或对旧版本的 android/兼容性使用 AppCombatCheckBox。

    <android.support.v7.widget.AppCompatCheckBox 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        app:buttonTint="@color/CHECKMARK_COLOR_HERE" /> 
    

    更多答案在this链接中

    【讨论】:

      猜你喜欢
      • 2013-12-30
      • 1970-01-01
      • 2012-10-05
      • 2011-08-16
      • 1970-01-01
      • 1970-01-01
      • 2022-01-24
      • 2019-09-02
      • 1970-01-01
      相关资源
      最近更新 更多