The main problem is that you are using a solid color instead of using Drawables. It is a drawback in the layout framework that if you set the solid colors, then the problem of hold occurs.
The code which you are using as :
<item name="android:listSelector">@color/red</item>
should be used as :
<item name="android:listSelector">@drawable/list_view_selector</item>
The above written drawable should be enclosed in the selector tag.
Here is the code for the list_view_selector
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_enabled="true"
android:state_pressed="true" android:drawable="@drawable/background_selected" />
<item android:state_enabled="true"
android:state_focused="true" android:drawable="@drawable/background_selected" />
<item android:state_enabled="true"
android:state_selected="true" android:drawable="@drawable/background_selected" />
</selector>
Note : You cannot use the solid color as it is. You have to make the selectors for the each color tone as :
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:angle="90"
android:centerColor="#ff0000"
android:endColor="#ff0000"
android:startColor="#ff0000" />
</shape>
I have checked this at my end. Working Perfect!!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…