Naz*_*ila 8 xml checkbox android
我有android checkBox,默认背景是透明的,我希望它是白色所以我使用样式:
<style name="BrandedCheckBox" parent="AppTheme">
<item name="colorAccent">@color/cyan</item>
<item name="colorControlNormal">@color/text_gray</item>
<item name="colorControlActivated">@color/cyan</item>
</style>
Run Code Online (Sandbox Code Playgroud)
并设置checkBox主题:
<CheckBox
android:id="@+id/check_payable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_gravity="center"
android:theme="@style/BrandedCheckBox"/>
Run Code Online (Sandbox Code Playgroud)
谁可以帮我这个事?
Rud*_*esh 13
你可以使用android:button
<CheckBox
android:id="@+id/check_box"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="@drawable/checkbox_background" />
Run Code Online (Sandbox Code Playgroud)
checkbox_background.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true"
android:drawable="@drawable/checkbox_checked" />
<item android:state_checked="false"
android:drawable="@drawable/checkbox_unchecked" />
</selector>
Run Code Online (Sandbox Code Playgroud)
我在drawable中使用这两个图像
归档时间: |
|
查看次数: |
6278 次 |
最近记录: |