自定义复选框图像的android自定义、复选框、图像、android

2023-09-12 00:09:55 作者:曾经再美好也只是曾经

有没有一种简单的方法来使用自定义图像的复选框?我期待复制的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?

推荐答案

复选框是按钮的孩子,你可以只给你框背景图片与几个国家如这里所描述,在按钮样式: 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

...和举例说明在这里: 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

 
精彩推荐
图片推荐