You'll have to provide background as a multi state drawable xml like
res/drawable/my_multi_state_bg.xml
Following is a sample xml.

<?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="true"
                android:drawable="@drawable/some_orange_color_or_png" />
    <item android:state_focused="false" android:state_pressed="true"
                android:drawable="@drawable/some_white_color_or_png" />
    <item android:drawable="@drawable/transparent_bg" />
</selector>

Point to that as in android:background="@drawable/my_multi_state_bg"
or through java code wherever u please.

stae_focused, state_pressed are used in this example.
There is another state_selected .. try combinations of true, false for
each.

On Oct 15, 10:50 am, Farproc <farp...@gmail.com> wrote:
> When we touch a Button in android, the button highlighted(background
> turns yellow). This visual change is very friendly to users. I want
> the same effect on a View object(for example a TextView or ImageView)
> but I can't figure it out. Somebody help me?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to