The following snippet will never show the checked state because when the system compares the state against the first item, it always matches as there is no specific state of it.
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" android:enterFadeDuration="@android:integer/config_shortAnimTime"> <item> <bitmap android:src="@android:drawable/ic_input_add" /> </item> <item android:state_checked="true"> <bitmap android:src="@android:drawable/star_big_on" /> </item> </selector>
Change the order of items and it works.
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" android:enterFadeDuration="@android:integer/config_shortAnimTime" > <item android:state_checked="true"> <bitmap android:src="@android:drawable/star_big_on"/> </item> <item> <bitmap android:src="@android:drawable/ic_input_add"/> </item> </selector>
No comments:
Post a Comment