开发者

how to get layouts/ views to show below viewflipper

I am trying to get a layout/ view to display below a viewflipper. Could anyone please tell me how to do so?

It works if layouts are shown above viewflipper, but not below it. E.g. the "Button" below refuses to show up if below viewflipper, but the "ImageButton" shows up above viewflipper.

Here's my xml code - it's v. basic.

Thanks for any help!

   <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:clickable="true" android:layout_height="wrap_content"
    android:layout_width="wrap_content" android:orientation="vertical">

    <RelativeLayout android:id="@+id/relativeLayout1"
        android:layout_width="match_parent" android:layout_height="wrap_content">
        <ImageButton android:id="@+id/homeButton"
            android:layout_alignParentLeft="true" android:layout_height="wrap_content"
            android:layout_width="wrap_content" android:clickable="true"
            android:src="@drawable/home"></ImageButton>
    </RelativeLayout>

    <ViewFlipper android:id="@+id/flipper"
        android:layout_width="fill_parent" android:layout_height="wrap_content"
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:background="@color/white">


        <include android:id="@+id/main2" layout="@layout/main2" />
        <include android:id="@+id/main3" layout="@layout/main3" />
        <include android:id="@+id/main4" layout="@layout/main4" />
    </ViewFlipper>

    <LinearLayout android:id="@+id/linearLayout"
        android:orientation="vertical" android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <Button android:layout_height="wrap_content"
            android:layout_width="wrap_content" android:id="@+i开发者_StackOverflowd/button1"
            android:text="Button"></Button>
    </LinearLayout>

</LinearLayout>


Try to make the viewflipper have layout_height="0dip" and layout_weight="100".

It must be happening because the ViewFlipper gets as big as required to fit the 3 inner layouts and thus no space is left for the last button. If you place the button before, that one gets some space allocated and the viewflipper gets the remaining space.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜