自定义复选框图像的android [英] Custom checkbox image android
问题描述
有没有一种简单的方法来使用自定义图像的复选框?我期待复制的Gmail的主演的行为。所以,我想有一个复选框是,检查的时候,是一个充满星。而选中的时候是空的明星。我一定要使用ImageView的,做自己的逻辑,我自己?
Is there an easy way to use a custom image for a checkbox? I'm looking to duplicate the "starred" behavior of gmail. So I want to have a checkbox that, when checked, is a filled in star. And when unchecked is an empty star. Do I have to use an imageview and do my own logic myself?
推荐答案
复选框是按钮的孩子,你可以只给你框背景图片与几个国家如这里所描述,在按钮样式:
<一href="http://developer.android.com/reference/android/widget/Button.html">http://developer.android.com/reference/android/widget/Button.html
Checkboxes being children of Button you can just give your checkbox a background image with several states as described here, under "Button style":
http://developer.android.com/reference/android/widget/Button.html
...和举例说明在这里: <一href="http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList">http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList
...and exemplified here: http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList
这篇关于自定义复选框图像的android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!