Victoria,

You can use a ViewFlipper, it can hold as many child views as necessary, displaying one child view (== layout) at a time.

Or you can use a FrameLayout, and manage child view visibility from code (initially - "hidden" or "gone", then change the ones you need to "visible").

Or, if your buttons only differ by their images, use one ImageButton and change its image from code: button.setImageResource(R.drawable.....)

-- Kostya

02.08.2010 12:59, Victoria Busse ?????:
I don't really understand what you mean, if I wanted to be able to switch the view each time a button is pressed and I got at least 4 buttons which all should call a new view, then as far as I
understood it I can't use a ViewSwitcher or can I?

On Mon, Aug 2, 2010 at 9:49 AM, schwiz <[email protected] <mailto:[email protected]>> wrote:

    You can get a handle on the views inside the switcher and change them
    as needed, it just only holds memory for 2 at a time.

    On Jul 31, 2:50 pm, Victoria Busse <[email protected]
    <mailto:[email protected]>>
    wrote:
    > That sounds great, but I just read that a ViewSwitcher only
    works with two
    > child views and I have at least 4 :((
    >
    >
    >
    > On Sat, Jul 31, 2010 at 8:20 PM, schwiz <[email protected]
    <mailto:[email protected]>> wrote:
    > > viewswitcher is probably better for what you are wanting to do
    >
    >http://developer.android.com/reference/android/widget/ViewSwitcher.html
    > > you can even assign animations for the views as they come and
    go if
    > > you want.
    >
    > > On Jul 30, 3:51 pm, Victoria Busse
    <[email protected] <mailto:[email protected]>>
    > > wrote:
    > > > Hi there,
    >
    > > > I am trying to populate a ViewStub with a new view depending
    on which
    > > > ImageButton is clicked, but as I just discovered ViewStubs I
    am not
    > > exactly
    > > > sure how this would work...
    >
    > > > e.g. can I provide the ViewStub with different inflatedIds
    and within the
    > > > onClick event of a Button inflate the ViewStub by calling a
    specific
    > > > inflatedId???
    >
    > > > If someone could give me hand, that would be really great.
    >
    > > > Thank you very much in advance :o)
    >
    > > --
    > > 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]
    <mailto:[email protected]>
    > > To unsubscribe from this group, send email to
    > > [email protected]
    
<mailto:android-developers%[email protected]><android-developers%2Bunsubs
    [email protected] <mailto:[email protected]>>
    > > For more options, visit this group at
    > >http://groups.google.com/group/android-developers?hl=en

    --
    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]
    <mailto:[email protected]>
    To unsubscribe from this group, send email to
    [email protected]
    <mailto:android-developers%[email protected]>
    For more options, visit this group at
    http://groups.google.com/group/android-developers?hl=en


--
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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


--
Kostya Vasilev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to