我想要应用自定义图像中的Android到复选框,为了这个,我创建一个 check_custom.xml
文件中,我定义自定义图像的复选框不同状态这样的:
I'm trying to apply custom image to checkbox in android, for this I create an check_custom.xml
file in which I define custom image for different states of check box like:
<item android:state_checked="true"
android:drawable="@drawable/btn_check_on" /> <!-- checked -->
<item android:state_checked="false"
android:drawable="@drawable/btn_check_off" /> <!-- unchecked -->
<item android:state_focused="true"
android:drawable="@drawable/btn_check_onfocus" /> <!--on focus-->
<item android:drawable="@drawable/btn_check_off" /> <!-- default -->
在检查,焦点和选中的三种状态三种不同的图像, 然后我将这个XML文件的复选框的背景属性,但我没有得到需要的结果,这种技术应用自定义图像,以及默认设置情况下的图像。
Three different images on three states on checked,on focus and on unchecked, and then I assign this xml file to background attribute of check boxes,but I'm not getting required result, this technique apply the custom image as well as default image both.
萨尔曼,设置安卓按钮
而不是安卓背景
。另请参见自定义复选框形象的Android
Salman, set android:button
instead of android:background
. See also Custom checkbox image android
上一篇:ListView的犯规火setOnLongClickListener,只有setOnItemClickListenerListView、setOnLongClickListener、setOnItem