listview - customize android.R.layout.simple_list_item_checked -
i want change drawable of predefined checked in
android.r.layout.simple_list_item_checked possible?
from checked
and unchecked
to checked 
and unchecked 
and don't want create custom list item.
this possible using custom layout standard adapter, can defining same ids predefined layout custom layout changing ones want. unfortunately in case, source code android.r.layout.simple_list_item_checked doesn't have drawable default. (https://github.com/android/platform_frameworks_base/blob/master/core/res/res/layout/simple_list_item_checked.xml) uses checkmark attribute
android:checkmark="?android:attr/textcheckmark" i'm unsure whether can change this, still reccomend using custom layout standard adapter, compare original current layout , define same attributes drawable instead of checkmark, in example below: it's though.
<checkbox android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="new checkbox" android:background="@drawable/checkbox_background" android:button="@drawable/checkbox" /> this how assign custom images saved in @drawable directly depending on state of checkbox.
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="true" android:state_focused="true" android:drawable="@drawable/first" /> <item android:state_checked="false" android:state_focused="true" android:drawable="@drawable/second" /> <item android:state_checked="false" android:drawable="@drawable/third" /> <item android:state_checked="true" android:drawable="@drawable/fourth" /> </selector> further reading: http://developer.android.com/reference/android/widget/compoundbutton.html#setchecked%28boolean%29
more here: http://www.android-ios-tutorials.com/android/custom-android-checkbox-radiobutton/
Comments
Post a Comment