【发布时间】:2014-06-26 01:06:05
【问题描述】:
我想增加复选框中检查的大小。我正在考虑为新支票添加图像。但我在 XML 中看不到任何选项来更改复选框的检查。是否有我缺少的 XML 选项或将新检查图像添加到 java 的方法。
【问题讨论】:
我想增加复选框中检查的大小。我正在考虑为新支票添加图像。但我在 XML 中看不到任何选项来更改复选框的检查。是否有我缺少的 XML 选项或将新检查图像添加到 java 的方法。
【问题讨论】:
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/checkbox" android:state_checked="false"/>
<item android:drawable="@drawable/checkboxselected" android:state_checked="true"/>
<item android:drawable="@drawable/checkbox"/>
将其添加到 xml 中的复选框
<CheckBox
android:layout_width="match_parent"
android:layout_height="wrap_content"
**android:button="@drawable/checkbox_selector"**
android:text="CheckBox"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/Black" />
【讨论】:
您可以通过设置CheckBox 的android:button 来更改复选框Drawable。
有关如何创建 Drawable 的更多信息,请参阅此答案:https://stackoverflow.com/a/17647520/379245
【讨论】: