2012-09-04 18 views
0

我有兩個使用標籤切換的活動。我遇到問題,我的活動內容未正確調整大小以適應選項卡窗口小部件的高度(因此活動內容顯示在選項卡後面)。底部有標籤。我曾嘗試使用標籤佈局等,但沒有運氣。如何解釋佈局中的tabwidget高度?

設計一個佈局(對於標籤內容活動)來說明android中的標籤高度有沒有辦法?我的猜測是,我爲活動設計佈局的方式在將其添加到選項卡主機後太高。這在iOS上是可能的,但不知道如何在android上完成。有任何想法嗎?

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

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" > 

     <TabWidget 
      android:id="@android:id/tabs" 
      android:layout_alignParentBottom="true" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 
     </TabWidget> 

     <FrameLayout 
      android:id="@android:id/tabcontent" 
      android:layout_above="@android:id/tabs" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 
     </FrameLayout> 
    </RelativeLayout> 

</TabHost> 

回答

0

一個非常簡單的解決方案是使用固定大小的選項卡,例如,

<TabWidget 
     android:id="@android:id/tabs" 
     android:layout_alignParentBottom="true" 
     android:layout_width="match_parent" 
     android:layout_height="64dp"> 
    </TabWidget> 
+0

並根據屏幕大小(小,正常,大,xlarge)我可以有不同的標籤高度。然後,在設計活動佈局時,我將擁有一個佔位符視圖。我認爲這可行,我會追求這個選擇。感謝您及時的回覆! – mikemeli