2014-03-19 78 views
0

我使用TAB主機,用5個活動,我可以通過標籤切換,當我在一個單獨的應用程序的每個權重屬性工作正常運行機智活動獨奏。但是,當我運行它們在一個選項卡主機重量屬性不起作用。爲什麼如此。我必須做的說,如果我不得不把它在我的1當前應用什麼:在接頭主機以3:2的比例?權重屬性不工作

對於剛剛測試目的我創建了兩個線性佈局1:1成的比例,當我運行它們彷彿在標籤白熱化重量,同時在一個簡單的應用程序它工作不工作1個活動?怎麼了。

XML 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="match_parent" 
    android:layout_height="fill_parent" 
    > 

    <RelativeLayout 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:orientation="vertical" 
     android:gravity="center_horizontal" 
     > 

     <FrameLayout 
      android:id="@android:id/tabcontent" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:background="@android:color/white" 
      /> 

     <TabWidget 
      android:id="@android:id/tabs" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentBottom="true" 
      android:background="@color/darkblue_bottombar" 
      android:paddingBottom="1sp" 
      android:gravity="center_horizontal" 
      android:paddingLeft="200sp" 
      android:paddingRight="200sp"></TabWidget> 

      </RelativeLayout> 

</TabHost> 

TAB2 XML

<?xml version="1.0" encoding="UTF-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" 
    android:weightSum="1" > 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight=".5" 
     android:orientation="vertical" > 

     <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="match_parent" 
      android:background="@color/Dialog_done_grey" 
      android:padding="15dip" 
      android:text="CHECK4" 
      android:textSize="18dip" /> 
    </LinearLayout> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight=".5" 
     android:orientation="vertical" > 

     <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="match_parent" 
      android:background="@color/blue_header" 
      android:padding="15dip" 
      android:text="CHECK5" 
      android:textSize="18dip" /> 
    </LinearLayout> 

回答

0

在 改變屬性高度FILL_PARENT

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