2012-04-03 63 views
0

我使用XML创建TabHost,并在使用findViewByID()的Activity中调用它。 我把tabhost和tabwidget的严重性是正确的,但它不是工作,我怎么能使它工作?android: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" 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"调用此XML布局不TabActivity

这里是布局的xml文件,谢谢。只要包括layout_gravity并看看它是否有效

+0

我应该在哪里使用它,因为没有android:重力在tabhost但有android:layout_gravity – 2012-04-03 18:01:52

+0

设置为您的** LinearLayout ** ... – waqaslam 2012-04-03 19:05:20