I have a multi select item listview based on a custom row layout inside a fragment. I would like each checked row to be highlighted.
Problem is when i click a row the checked rows do not stay highlighted but the font color of the text changes. I do not get this issue when using android.R.layout.simple_list_item_1 . Thanks in advance
onCreateView Code
...
listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
getLoaderManager().initLoader(LOADER, null, this);
adapter = new ContactFragmentAdapter(
getActivity().getApplicationContext(),null,0);
listView.setAdapter(adapter);
Custom row layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<TextView
android:id="@+id/simple_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="test"
/>
</LinearLayout>
ListView Code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<ListView
android:id="@+id/contact_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@null"
/>
</LinearLayout>