2012-05-16 2 views
2

Je pense que j'ai une question simple.Mise en page sur les onglets

Je travaille avec des onglets et mon code xml est:

<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> 

Le problème est que si je retire le rembourrage supérieur, quand j'ouvre un onglet, le contenu de l'onglet est au-dessus.

Faire de cette façon ne m'apportera pas de problèmes? Comment le contenu ne peut-il pas le dépasser?

Répondre

1

Essayez de placer le TabWidget et le FrameLayout à l'intérieur d'un LinearLayout vertical. Cela forcera le FrameLayout à être sous le TabWidget.

+0

Merci beaucoup! Ça a marché! :) –

Questions connexes