It's very strange. I already tried this steps given.
But seems no luck. Whenever I click the item inside the ListView, the item is highlighted with black color. Instead of the blue color. Which part that I wrong?
Here is my activity_chat1.xml file:
<?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" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Available Peers"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pick one of the peers below : " />
<ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="128dp"
android:listSelector="@layout/list_selection"
android:choiceMode="singleChoice" />
<Button
android:id="@+id/btn_startchat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Start to Chat" />
</LinearLayout>
and Here is my list_selection.xml file:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@color/pressed_color" android:state_pressed="true"/>
<item android:drawable="@color/checked_color" android:state_selected="true"/>
</selector>
an here is my color.xml file: (under res/values directory)
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="pressed_color">#4d90fe</color>
<color name="checked_color">#ffffff</color>
<color name="activated_color">#ffffff</color>
</resources>