First of all you need to set the selection mode of a ListView
ListView lv=new ListView(this) or findViewById(R.id.my_list_view);
lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
and here is your xml file for a background
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_activated="true" android:drawable="@drawable/state_selected" />
<item android:drawable="@android:drawable/state_unselected" />
</selector>
here you go