选中我的复选框后,我希望颜色为@ color / colorPrimaryLight.我可以通过设置为Lollipop设置它
android:buttonTint="@color/colorPrimaryLight"
在CheckBox但我不知道如何在Lollipop之前做任何事情而不改变
@color/white
在我的主题.
CheckBox for Lollipop:
android:buttonTint="@color/colorPrimaryLight"
android:id="@+id/SwapCheckbox"
android:layout_marginTop="@dimen/margin_top"
android:layout_marginLeft="@dimen/margin_left_right"
android:layout_marginRight="@dimen/margin_left_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
并且在棒棒糖之前做任何事情(并且高于4.0.3):
android:id="@+id/SwapCheckbox"
android:layout_marginTop="@dimen/margin_top"
android:layout_marginLeft="@dimen/margin_left_right"
android:layout_marginRight="@dimen/margin_left_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
我也有我的应用程序的主题:
//...
@color/white
//...
我无法更改colorControlActivated,因为我的ViewPager中的指示器必须为白色.有没有改变我的复选框的背景颜色(即使它是默认的Holo风格,但最好是设置为@ color / colorPrimaryLight)?
解决方法:
在App compat主题中使用以下属性,如下所示
@color/colorAccent
并使用android.support.v7.widget.AppCompatCheckBox而不是CheckBox
标签:android,checkbox,appcompat
来源: https://codeday.me/bug/20190725/1528826.html