2011-05-09 84 views
0

在我的應用程序中我有一個標籤欄。它包含四個標籤,我在其中顯示列表視圖。它工作正常,但現在我需要將標籤欄移到屏幕底部。當我將代碼更改爲在視圖底部顯示選項卡欄時,列表視圖也以全屏幕方式與選項卡欄重疊顯示。添加標籤欄在Android的視圖底部的問題

下面是示例代碼

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/mainlayout" 
      android:layout_height="fill_parent" 
      android:layout_width="fill_parent" 
      android:orientation="vertical" > 
    <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:orientation="vertical" 
     android:background="#000000"> 

     <RelativeLayout 
      android:orientation="vertical" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:padding="5dp"> 

      <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
        android:id="@+id/Label" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:text="Credit Balance" 
        android:background = "#55000000" 
        android:textColor = "#FF0033" 
      /> 

      <TabWidget 
        android:id="@android:id/tabs" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        **android:layout_alignParentBottom = "true"**/> 
      <FrameLayout 
        android:id="@android:id/tabcontent" 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:padding="5dp" /> 
     </RelativeLayout> 
    </TabHost> 
</FrameLayout> 

我加入4個相應選項卡4個列表視圖用下面的代碼

tabHost.addTab(tabHost.newTabSpec(NEW_TAB).setIndicator(NEW) 
      .setContent(new Intent(this, NEWActivity.class))); 

請任何人都可以提出一個解決的辦法?

感謝

回答

3

android:layout_above="@android:id/tabs" 

行添加到您的FrameLayout並與TabWidget

android:layout_alignParentBottom = "true" 

+0

感謝Sujit與直又好,answer.Its工作的罰款。 – Rishi 2011-05-09 11:48:39

+0

+ 1謝謝...一直試圖找出一個小時 – 2012-05-14 21:38:01

相關問題