listview - List selector state selected not working [ANDROID] -
in app, using list view show list of items have 1 text , 1 image, have added list selector attribute list view list item clicked background color changed different one.the problem when list item selected listview's row (that text view , image view) background not changed state pressed working fine.how work? appreciated
listview
<listview android:id="@+id/list" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:choicemode="singlechoice" android:divider="@null" android:dividerheight="0dp" android:listselector="@drawable/nav_lists_selector" />
list selector
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" android:exitfadeduration="@android:integer/config_mediumanimtime"> <item android:drawable="@drawable/list_pressed" android:state_pressed="true"/> <item android:drawable="@drawable/list_selected" android:state_selected="true" /> </selector>
list pressed
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="@color/clr_list_pressed"/> </shape>
list selected
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="@color/clr_list_selected"/> </shape>
you need add "normal status" in list selector
<item android:drawable="@drawable/normal_list_color_or_image" />
you added status selected , pressed, don't added normal status.
"normal status" when component don't have received 1 action.
Comments
Post a Comment