2011-01-23 44 views
0

所以我有一個帶有2個選項卡的選項卡活動。在這些之下,我想有第二種觀點。 目前我可以將視圖放在最後,但它仍然與當前可見選項卡末尾的任何內容重疊。有沒有人有一個想法,如何獲得標籤下的第二個視圖,而不是重疊其內容的結尾?Android:在TabActivity下添加視圖

因此,舉例來說,如果認爲只是一個TextView,我的佈局是這樣的:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 

    <TabHost android:id="@android:id/tabhost" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 

     <LinearLayout android:id="@+id/linearLayout" 
      android:orientation="vertical" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent"> 

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

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

     </LinearLayout> 
    </TabHost> 

    <RelativeLayout android:id="@+id/InnerRelativeLayout" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true"> 

     <TextView android:id="@+id/EndView" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:text="At the end of the screen"/> 

     </RelativeLayout> 
</RelativeLayout> 

回答

0

使用android:below="@id/tabhost"

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <TabHost ...> 
     ... 
    </TabHost> 

    <RelativeLayout android:id="@+id/InnerRelativeLayout" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:below="@id/tabhost"><!-- LOOK HERE --> 

     <TextView android:id="@+id/EndView" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:text="At the end of the screen"/> 

     </RelativeLayout> 
</RelativeLayout> 
+0

對於我得到「錯誤:沒有資源標識符發現屬性包'android'中的'below'。你的意思是「android:layout_below =」@ + id/tabhost「」?如果我這樣做,textview仍然重疊。 – Acet 2011-01-23 23:17:56