2012-02-24 25 views
0

私は下部タブのレイアウトを持っています。しかし、私はtabHostの上にストリップを設定することができません。どうやってするの?ありがとうございました。アンドロイド下部にタブストリップが表示されますtabHost

ここに私のメインのレイアウト:

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

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

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

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

    /> 
    </LinearLayout> 

</TabHost> 

ともタブのスタイルのためのセレクタ:

<selector xmlns:android="http://schemas.android.com/apk/res/android"> 

<item android:state_pressed="true" > 
    <shape> 
     <gradient 
      android:startColor="#aa3434" 
      android:endColor="#432233" 
      android:angle="270" 
      /> 
    </shape> 
</item> 

<item android:state_selected="true" > 
    <shape> 
     <gradient 
      android:startColor="#aa3434" 
      android:endColor="#432233" 
      android:angle="270" /> 
    </shape> 
</item> 

enter image description here

答えて

0

このコードを試みた

<?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" > 
    <LinearLayout 
     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_weight="0" /> 
     <FrameLayout 
      android:id="@android:id/tabcontent" 
      android:layout_width="fill_parent" 
      android:layout_height="0dip" 
      android:layout_weight="1" /> 
    </LinearLayout> 

</TabHost> 
+0

が、変更なしを試してみてください。 ( – Jaume

+0

このコードは既に私のプロジェクト –

+0

の下部にあるタブを使って実装していますか? – Jaume

関連する問題