It is done via a selector...  There is not a lot of documentation about
them, the basic premise is that it is an xml file that defines drawables to
be used when certain conditions/states are met... such as when something
gets focus.  It goes in the res/drawable folder just like any other drawable
and is referenced the same way.

Here is an example of a selector that I use in one of my apps:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android";>
    <!--  Focused -->
    <item android:drawable="@drawable/gallery_selection_red_small"
android:state_focused="true" android:state_selected="true"
android:state_pressed="true" />
    <item android:drawable="@drawable/gallery_selection_orange_small"
android:state_focused="true" android:state_selected="true"
android:state_pressed="false" />
    <item android:drawable="@drawable/gallery_selection_orange_small"
android:state_focused="true" android:state_selected="true"
android:state_pressed="true" />
    <item android:drawable="@drawable/gallery_selection_orange_small"
android:state_focused="true" android:state_selected="false"
android:state_pressed="true" />

    <!--  Not Focused -->
    <item android:drawable="@drawable/gallery_selection_blue_small"
android:state_focused="false" android:state_selected="true"
android:state_pressed="false" />
    <item android:drawable="@drawable/gallery_selection_red_small"
android:state_focused="false" android:state_selected="true"
android:state_pressed="true" />
    <item android:drawable="@drawable/gallery_selection_red_small"
android:state_focused="false" android:state_selected="false"
android:state_pressed="true" />

    <!--  Default -->
    <item android:drawable="@drawable/translucent_box" />
</selector>

Hope that helps,
Justin

----------------------------------------------------------------------
There are only 10 types of people in the world...
Those who know binary and those who don't.
----------------------------------------------------------------------


On Mon, Jan 25, 2010 at 9:16 PM, Vivek Satpute <[email protected]>wrote:

> Hi,
>
> In android-sdk emulator, we have a default browser. Suppose I opened any
> site in
> that browser. Whenever I click on any link in browser webpage, I can see a
> rectangular
> box around that link. Could anyone tell me how that is implemented ?
>
>
> Any suggestions will be appreciated.
>
>
> Thanks,
> Vivek
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Beginners" group.
>
> NEW! Try asking and tagging your question on Stack Overflow at
> http://stackoverflow.com/questions/tagged/android
>
> To unsubscribe from this group, send email to
> [email protected]<android-beginners%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-beginners?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to