As seen in the tablet version of gmail and google talk I am trying to show the current selection in a listview. I know this is not standard practice and should be avoided when necessary.in my program the listview is alway on the screen and the item clicked shows a new fragment to the right (similar to gmail and google talk).
To avoid the user from guessing what item has been selected I would like to show the current selection, I tried creating a selector but after it is clicked it changes back to the normal background.
how can I achieve this?
this is my selector xml
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/list_item_bg2" android:state_pressed="false" android:state_selected="false"
android:state_focused="false"/>
<item android:drawable="@drawable/list_item_selected_bg2" android:state_pressed="true"/>
<item android:drawable="@drawable/list_item_selected_bg2" android:state_pressed="false" android:state_focused="false"
android:state_selected="true" android:state_checked="false"/>
<item android:drawable="@drawable/list_item_selected_bg2" android:state_pressed="false" android:state_focused="true"
android:state_selected="false"/>
<item android:drawable="@drawable/list_item_selected_bg2" android:state_pressed="false" android:state_focused="false"
android:state_selected="false" android:state_checked="true"/>
<item android:drawable="@drawable/list_item_selected_bg2" android:state_pressed="true" android:state_focused="true"
android:state_selected="true" android:state_checked="true"/>
<item android:drawable="@drawable/list_item_selected_bg2" android:state_pressed="true"/>
</selector>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…