I have created a listview with simplecursoradapter and made it to Highlight when any of the item is clicked on it with the following code.
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_selected="true"
android:drawable="@color/blue" />
<item
android:drawable="@color/white" />
</selector>
and on Item selected i have done as below.
list = (ListView) view.findViewById(android.R.id.list);
adapter = new SimpleCursorAdapter(getActivity(), R.layout.title_intro_list, articleCur, FROM, TO,1);
list.setAdapter(adapter);
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, final View view,
int position, long id)
{
view.setSelected(true);
}
It's working fine ,when i select the item in listview it get selected , But the problem is when i scroll the listview the item selected doesn't remain highlighted.