I am trying to create a custom tabbed layout with a viewflipper. Therefore, I need two buttons side-by-side at the top of the screen. I have this. However, I am trying to get the viewFlipper content below these two buttons. Here is my current XML (which does not show the textviews)
<LinearLayout
android:id="@+id/linearLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#FAFAFA"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:id="@+id/linearLayout02"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button android:id="@+id/button1" android:text="button 1" android:layout_height="wrap_content" android:layout_width="0dip" layout_weight = ".5"/>
<Button android:id="@+id/button2" android:text="button 2" android:layout_height="wrap_content" android:layout_width="0dip" layout_weight = ".5"/>
</LinearLayout>
<RelativeLayout
android:id="@+id/relativeLayout01"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_below="@id/linearLayout02">
<ViewFlipper
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:id="@+id/viewFlipper01">
<include
android:id="@+id/one"
layout="@layout/view_one" />
<include
android:id="@+id/two"
layout="@layout/view_two" />
</ViewFlipper>
</RelativeLayout>
</LinearLayout>
Your
LinearLayoutthat contains the buttons has alayout_height="fill_parent". You need to set that towrap_contentand also specify theorientation="vertical"in the parentLinearLayout. You’ll also need to specify alayout_weightfor the view that you want to stretch to fill.Because
linearLayout01LinearLayouthas itslayout_heightset tofill_parent, android is going to make it take up the reset of the screen. The content below that will not be visible at all because it is off the screen.