2011-01-23 39 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