1.在listview中设置choiceMode=”singleChoice”
<ListView
android:id="@+id/lv_system_bell"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:choiceMode="singleChoice"
>
</ListView>
2.在selector中设置activited = true,图片是自定义的
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_activated="true"android:drawable="@drawable/bell_selected">
</item>
</selector>
3.在item中设置checkbox的属性,将background设置为步骤2的selector,将focusable和focusableInTouchMode设置为false
<CheckBox
android:id="@+id/cb_bell"
android:layout_width="20dp"
android:layout_height="15dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="15dp"
android:background="@drawable/bg_bell"
android:button="@null"
android:focusable="false"
android:focusableInTouchMode="false" />
4.完成!看效果…