2012-04-03 5 views
0

私はXMLでTabHostを作成し、それをfindViewByID()を使ってアクティビティで呼び出す。 私はtabhostとtabwidgetの重力を正しく置くことができますが、それは動作しません、どうすればそれを動作させることができますか?アンドロイド:TabHost重力が働かない

注:私は、レイアウトのXMLファイルです、おかげでアドバンス

<?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" android:layout_gravity="right" android:foregroundGravity="right" > 

    <LinearLayout 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="@android:color/white"> 

    <TabWidget 
     android:id="@android:id/tabs" 
     android:layout_width="fill_parent" 
     android:layout_height="30dp" 
     android:background="@drawable/submenu_bg" android:layout_gravity="right"/> 

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

     <ProgressBar 
     android:id="@+id/loading_secondary_tabs" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" android:layout_gravity="center" /> 
     </FrameLayout> 

</LinearLayout> 

</TabHost> 

答えて

0

に私はあなたがandroid:gravity="right"を設定する必要があると思う。ここ

ないTabActivity

での活動でこのXMLレイアウトを呼び出しました。ただ、 layout_gravityとそれはアンドロイドがないので、私は、それを使用する必要があり

+0

を動作するかどうかを確認するとともに、これを含める:tabhostにおける重力しかしアンドロイドがあります:layout_gravity –

+0

はあなたの**のLinearLayout **にこれを設定し... – waqaslam

関連する問題