您的位置:首页 > 其它

checkbox点击切换图片

2013-11-18 16:36 106 查看
layout.xml

<CheckBox
android:id="@+id/task_info_list_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:focusable="false"
style="@style/task_info_checkbox"
android:layout_weight="1"
/>


styles.xml

<style name="task_info_checkbox">
<item name="android:button">@drawable/task_type_image_selector</item>
</style>


drawable下面建立task_type_image_selector.xml

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_checked="true" android:drawable="@drawable/btn_check_on" />
<item android:state_checked="false" android:drawable="@drawable/btn_check_off_pressed" />
</selector>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: