2012-02-15 6 views
0

タブレイアウトをボトムに設定するにはどうすればよいですか? 私はアンドロイド下部にタブレイアウトを設定するには

android:gravity="bottom" 
android:layout_marginBottom="-3dp" 

ではなく、任意の効果は、このプロパティをしようとすると、エラーを与えます。

+1

あなたのレイアウトを教えてください。この質問もチェックしてください:http://stackoverflow.com/questions/3039674/tabwidget-not-stable-at-the-bottom-in-android-why – Olegas

+0

[こちらをご覧ください](http://stackoverflow.com/a/ 6992662/593709)iPhoneがタブホストのようにしたい場合。 –

答えて

0
Place Tab Widget to below FrameLayout like this 

<?xml version="1.0" encoding="utf-8"?> 

<TabHost xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/tabHost" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent"> 
    <LinearLayout android:orientation="vertical" 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent"> 

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

     </FrameLayout> 


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



    </LinearLayout> 
</TabHost> 
0

あなたはレイアウトボトムでそれを設定するための最良のアンドロイドタブレイアウトがあります。

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="0dip" 
android:layout_height="55dip"  
android:layout_weight="1" 
android:orientation="vertical" 

android:background="@drawable/tab_indicator" 
android:padding="5dp"> 

<ImageView android:id="@+id/icon" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_centerHorizontal="true" 
    android:src="@drawable/icon" 

/> 

<TextView android:id="@+id/title" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_centerHorizontal="true" 
    style="?android:attr/tabWidgetStyle" 
/>  

そして、このanswerを参照してください - ただ、このコードを使用します。これがあなたを助けることを願っています

関連する問題