Fabiano Palaoro
Fabiano Palaoro

Reputation: 267

Layout on top of Tabs

I think I have a simple question.

I'm working with tabs and my xml code is:

<TabHost android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/tabHost"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<TabWidget
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@android:id/tabs"
/>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@android:id/tabcontent"
>
    <LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:id="@+id/tab1"
    android:orientation="vertical"
    android:paddingTop="100px"
    >
    <TextView 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" 
    android:id="@+id/teste" />
    </LinearLayout>
    <LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/tab2"
    android:orientation="vertical"
    android:paddingTop="60px"
    >
    </LinearLayout> 
    <LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/tab3"
    android:orientation="vertical"
    android:paddingTop="60px"
    >
    </LinearLayout>
</FrameLayout>
</TabHost>

The problem is that if I remove the top padding, when I open a tab, the tab's content is above it.

Doing this way will not bring me problems? How can the content does not above it?

Upvotes: 2

Views: 90

Answers (1)

Squonk
Squonk

Reputation: 48871

Try putting the TabWidget and FrameLayout inside a vertical LinearLayout. This will force the FrameLayout to be under the TabWidget.

Upvotes: 1

Related Questions