Nothing shows up because the children of your ViewFlipper are:

<View
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/view_exposure"
android:layout="@layout/exposureview"
>

Those are just empty views, so nothing shows up.

Create some kind of layout with "real" views inside here - at least a View with fixed (e.g. 100dp) width and height and some background color, just to see how it's working.

You might also want to take a look at this:

http://developer.android.com/resources/articles/layout-tricks-reuse.html

to be able to reuse the layouts you've already when trying to work with ViewStub.

So you could do:

<ViewFlipper ..... >

<include android:id="@+id/view_exposure" layout="@layout/exposureview" />
<include android:id="@+id/view_properties" layout="@layout/propertiesview" />

</ViewFlipper>

-- Kostya

02.08.2010 15:33, Victoria Busse пишет:
I already tried that with the same result... nothing shows up :(

It seems that the View inside the Flipper doesn't call the layout via android:layout="@layout/exposureview"


On Mon, Aug 2, 2010 at 12:12 PM, Kostya Vasilyev <[email protected] <mailto:[email protected]>> wrote:

    setDisplayedChild takes the index of the view to display.

    Try setDisplayedChild(0), setDisplayedChild(1), etc.

    02.08.2010 15:06, Victoria Busse пишет:
     I got a question regarding the FlipperView: I was trying to call
    a certain childView (that calls a layout) when a button is
    clicked...but I don't get any results.. what am I doing wrong?


    public void onClick(View v){
    if (v == btnExposure){
    mFlipper.setDisplayedChild(R.id.view_exposure);
    }
    else if (v == btnProperties){
    mFlipper.setDisplayedChild(R.id.view_properties);
    }
    }

    <ViewFlipper
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/flipper"
    android:layout_toRightOf="@id/button_exposure">
    <View
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/view_exposure"
    android:layout="@layout/exposureview"
    >
    </View>
    <View
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/view_properties"
    android:layout="@layout/propertiesview"
    >
    </View>
    </ViewFlipper>

    On Mon, Aug 2, 2010 at 10:30 AM, Victoria Busse
    <[email protected]
    <mailto:[email protected]>> wrote:

        Hey Kostya,

        a ViewFlipper, there are so many things about Android I
        haven't found out yet :) but from what I understand and have
        just read about it, this would be exactly what I need...
        because only one child View should be displayed at a time,
        and the view should change depending on which button was
        pressed. Thanks...I will give it a shot!!!


        On Mon, Aug 2, 2010 at 10:19 AM, Kostya Vasilyev
        <[email protected] <mailto:[email protected]>> wrote:

            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]
            <mailto:[email protected]>
            To unsubscribe from this group, send email to
            [email protected]
            <mailto:[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]
            <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]
    <mailto:[email protected]>
    To unsubscribe from this group, send email to
    [email protected]
    <mailto:[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]
    <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