2011-12-23 45 views
0

我的android視圖底部有一個自定義的tabbar。 我想在主頁面上顯示「GONE」,因爲主頁面內容應該佔據整個高度。Android碎片Tabbar - 主頁上不可見?

但是在我看來,即使當我設置visibility =「gone」時,由於內容視圖不是全高,所以在渲染主頁時仍然會考慮tabbar的100dp高度。

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

    <FrameLayout android:layout_width='fill_parent' 
    android:layout_height="match_parent" 
    android:layout_weight="1" 
    android:orientation="vertical" android:id="@+id/content"> 

    </FrameLayout> 

    <fragment android:name="MainActivity$TabBarFragment" 
    android:visibility="gone" 
    android:id="@+id/tabbar" 
    android:layout_weight="1" 
    android:layout_width="fill_parent" 
    android:layout_height="100dp"/> 

我怎樣才能獲得內容查看充分高度的炫魅?

回答

0

自己找到了。

我現在使用:

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

<FrameLayout android:layout_width='fill_parent' 
    android:layout_height="fill_parent" 
    android:layout_weight="1" 
    android:orientation="vertical" android:id="@+id/content"> 

</FrameLayout> 

<fragment android:name="MainActivity$TabBarFragment" 
    android:id="@+id/tabbar" 
    android:layout_weight="1" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"/> 

,取而代之的是TabBarFragment佈局文件定義它的身高和知名度定義了=。 這是有效的。