I saw a lot of posts on this subject, but none of them seem to work. So here.
I am testing my Android app in ICS / JB. I have a list of items and with a long click on an item in this list, I show a context action bar.
The list selector is lost after the action bar pops up. I would like it to stay constant while the action bar remains.
I used a selector. 1 for the list selector and another for the list item selector. I also experimented with activated state.
The only thing that ultimately worked was when I manually change the background to the click listener. But then it becomes too difficult to keep track of which item is selected and which item is missing, and reset them according to their state.
Is there a direct way for a list item to stand out when performing an action in its context.
Please inform. I am getting away with this problem.
In response to Al: In one of these permutations, the choice does appear, but does not disappear.
If I close the contextual action panel or select a menu item in the panel, it remains. If I select the same item again, it will remain.
The only way is to click another item in the list and the selection will switch to the new item.
Position selection:
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_selected="true" android:drawable="@android:color/black" /> <item android:state_activated="true" android:drawable="@android:color/holo_blue_bright" /> <item android:state_activated="true" android:state_focused="false" android:drawable="@android:color/holo_orange_light" /> <item android:state_focused="true" android:drawable="@drawable/selectedrow" /> <item android:state_pressed="true" android:drawable="@android:color/holo_green_dark" /> <item android:state_focused="false" android:drawable="@android:drawable/btn_radio" /> </selector>
source share