That looks exactly like what I need.

Where exactly do you create that selector definition though, does that
go in the styles.xml file? Then you somehow set that as the background
of the LinearLayout instance? Right now I've simply defined my
LinearLayout in an xml file:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

      .. other stuff

</LinearLayout>


so I just need to add the android:background attribute of the above
definition to point to that selector definition?

Thanks a lot,
Mark


On Apr 9, 2:27 pm, "Romain Guy" <[EMAIL PROTECTED]> wrote:
> To do this you will need to give your LinearLayout a background that
> supports states. For instance:
>
> <selector xmlns:android="http://schemas.android.com/apk/res/android";>
>     <item android:state_focused="true" android:state_pressed="true"
> android:drawable="@drawable/pressed_application_background_static" />
>     <item android:state_focused="false" android:state_pressed="true"
> android:drawable="@drawable/pressed_application_background_static" />
>     <item android:state_focused="true"
> android:drawable="@drawable/focused_application_background_static" />
>     <item android:state_focused="false"
> android:drawable="@android:drawable/empty" />
> </selector>
>
>
>
>
>
> On Wed, Apr 9, 2008 at 11:20 AM, Mark Wyszomierski <[EMAIL PROTECTED]> wrote:
>
> >  Hi Romain Guy,
>
> >  The LinearLayout instance is indeed clickable, but is there a way to
> >  get it to flash orange like a normal button? I guess that's the only
> >  part missing to making it look more button-ish,
>
> >  Thanks,
> >  Mark
>
> >  On Apr 9, 12:39 pm, "Romain Guy" <[EMAIL PROTECTED]> wrote:
> >  > Actually there is. Home for instance uses a LinearLayout to create the
> >  > buttons on the right. Simply call setClickable() and setFocusable() on
> >  > your LinearLayout then add an OnClickListener.
>
> >  > On Wed, Apr 9, 2008 at 9:23 AM, Hielko <[EMAIL PROTECTED]> wrote:
>
> >  > >  It's possible to implement, but there is no default method that can do
> >  > >  that for you.
>
> >  > >  On Apr 9, 5:39 pm, Mark Wyszomierski <[EMAIL PROTECTED]> wrote:
> >  > >  > Hi Everyone,
>
> >  > >  > Is there any way to make a whole LinearLayout instance behave like a
> >  > >  > big button, so it flashes when clicked?
>
> >  > >  > Similar to an ImageButton, but I'd like to be able to set the entire
> >  > >  > layout as the button really.
>
> >  > >  > Thanks,
> >  > >  > Mark
>
> >  > --
> >  > Romain Guywww.curious-creature.org-Hide quoted text -
>
> >  > - Show quoted text -
>
> --
> Romain Guywww.curious-creature.org- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to