I have this layout for a listview's items
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/card_layout_bg"
android:state_pressed="false"/>
<item android:drawable="@drawable/card_layout_pressed_bg"
android:state_pressed="true"/>
<item android:drawable="@drawable/card_layout_pressed_bg"
android:state_selected="true"/>
</selector>
With the third item i tried to show which item is selected when actionmode context menu appears, but I can not figure out which state do I have to use to get the expected result
You should add the
activated
state background to your selector as well, in order to display the selection of aListView
: