Hello,
I am using the code above to change the colors for selected/pressed
states in my ListActivity. I want my ListActivity to be just like the
default one only with my colors. There is one problem when I try my
code below, it doesn't flash my pressed color when I use the DPAD to
select an item from the list. Everything works great when I use the
touch interface but I can't figure out the right combination of states
to get the pressed color to flash after pressing DPAD_CENTER.
My code:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_selected="false"
android:state_pressed="true"
android:drawable="@drawable/list_item_pressed"/>
<item
android:state_selected="true"
android:drawable="@drawable/list_item_focused"/>
<item
android:drawable="@drawable/transparent"/>
</selector>
This code works great for touch.
Can somebody tell me the combo I need to make my color flash with
DPAD_CENTER selection?
Thanks,
Kevin
On Mar 20, 8:33 pm, lavanya <lava...@gmail.com> wrote:
Hi,
Thanks for the help Megha.Got what I wanted.
<?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:state_selected="true"
android:drawable="@drawable/blue"
/>
<item android:state_focused="true"
android:state_pressed="true"
android:drawable="@drawable/green" />
<item android:state_focused="false"
android:state_pressed="true"
android:drawable="@drawable/silver" />
<item android:state_selected="true"
android:drawable="@drawable/lightyellow"
/>
<item
android:drawable="@drawable/lightgreen"
/>
</selector>
If I use the code above things seem to work.However,if I declare the
colors directly (as in my previous post) I get an error.Maybe its
because a drawable can only reference other drawables?Anyways,thanks