views:

61

answers:

1

In my app i'm setting background to each child views in listview. So that listview default focus ( orange color ) is not focusing.

Is there any way to set both ( listview focus & child view background ) ?..

A: 

Hi,

It is possible if you define the item background as StateListDrawable. In XML it's done with selector

ognian
Ognian, Thanks fro your reply...I'm using selector only.. I'm getting image only in pressed state not in focus.. You have any idea ?...
Sasikumar.S
Can you post your selector's code?
ognian
This is my code<code><?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/img_focused" /> <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/img_selected" /> <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/img_selected" /> <item android:drawable="@drawable/img_default" /></selector> </code>
Sasikumar.S