i am implementing a splitview using the new fragment from Google (Android 3).
when user choose something from the list it is show value in the details area and keep list item highlight.
when i used array adapter it is keep list item focused after adding the following:
getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
getListView().setItemChecked(postition, true);
but when i change to use database using SimpleCursorAdapter and custom row xml file it is highlight just when i press.
“i want to keep highlight item in list view”
You need to set the activated style for your list row. The catch is that this is only available on API Level 11 and higher.
One way to do this is to use two separate styles. In
res/values-v11/styles.xml, you could have:Whereas
res/values/styles.xmlyou would have:Your row layout would then use that
activatedstyle, such as:Combined with your existing
CHOICE_MODE_SINGLElogic, this will leave your row activated after it is tapped.