ggo*_*eze 152
混合类型:
在布局文件中设置它: -
<CheckBox android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="new checkbox"
android:background="@drawable/checkbox_background"
android:button="@drawable/checkbox" />
Run Code Online (Sandbox Code Playgroud)
@ drawable /复选框的外观如下:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:state_focused="true"
android:drawable="@drawable/checkbox_on_background_focus_yellow" />
<item android:state_checked="false" android:state_focused="true"
android:drawable="@drawable/checkbox_off_background_focus_yellow" />
<item android:state_checked="false"
android:drawable="@drawable/checkbox_off_background" />
<item android:state_checked="true"
android:drawable="@drawable/checkbox_on_background" />
</selector>
Run Code Online (Sandbox Code Playgroud)
小智 7
这可以通过使用来实现AppCompatCheckBox。您可以使用app:buttonCompat="@drawable/selector_drawable"来更改选择器。
它适用于 PNG,但我没有找到适合 Vector Drawables 的方法。
我意识到这是一个老问题,OP正在讨论使用不需要'复选框'看的自定义gx,但是这里有一个生成自定义彩色资源的绝佳资源:http:// android-holo-colors .COM
只需给它相关的细节,它就会吐出图形,完整的xml资源,你可以直接进入.
| 归档时间: |
|
| 查看次数: |
90209 次 |
| 最近记录: |