I am using this code below, but it doesn't work properly: If I select an item, the background is changed. But the background change also if I put only focus on the item without selecting it. Why ?
Added to my listview:
android:listSelector="@drawable/bg_key"
@drawable/bg_key
<?xml version="1.0" encoding="utf-8"?>
<selector
android:id="@+id/myselector"
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_activated="false"
android:drawable="@color/activated_color" />
</selector>
color.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="activated_color">#1d1d1d</color>
</resources>