2011-03-23 3 views
2

Je vais avoir l'écran suivant, enter image description hereComment afficher les onglets Au bas plutôt qu'en haut?

J'utilise le code suivant pour faire la mise en page pour afficher tabhost et onglet widget de

enter image description here

Je veux placer les onglets en bas. Dites-nous comment procéder.

+1

Pourquoi publier-vous votre code comme une image? –

Répondre

3

Hé, je l'ai fait en utilisant le code suivant:

<LinearLayout 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:padding="5dp"> 

    <FrameLayout 
     android:id="@android:id/tabcontent" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:padding="5dp" 
     android:layout_weight="1"/> 

    <TabWidget 
     android:id="@android:id/tabs" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="0"/> 

</LinearLayout> 

+0

ne fonctionne pas avec android.support.v4.app.FragmentTabHost. plz suggérer –

1

Essayez cela, il est un widget onglet below..In vous devez spécifier la gravité de appereance du Onglet (c.-à-d.) V

<LinearLayout android:orientation="vertical" android:background="#000000" android:id="@+id/tab" 
    android:layout_width="fill_parent" android:layout_height="fill_parent"> 

    <TabWidget android:id="@android:id/tabs" android:background="@drawable/gradient_black" 
     android:gravity="bottom" android:listSelector="#999999" 
     android:layout_width="fill_parent" android:layout_height="63dip" /> 
</LinearLayout> 

0

code suivant montre les onglets en bas:

<?xml version="1.0" encoding="utf-8"?> 
<TabHost xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@android:id/tabhost" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 
    <RelativeLayout 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:orientation="vertical" > 
     <TabWidget 
      android:id="@android:id/tabs" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentBottom="true"> 
     </TabWidget> 
     <FrameLayout 
      android:id="@android:id/tabcontent" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:layout_above="@android:id/tabs"> 
     </FrameLayout> 
    </RelativeLayout> 
</TabHost> 
Questions connexes