2012-03-09 128 views
0

我有一個TabHost/TabWidget這樣的佈局:如何保持重疊TabWidget的佈局?

enter image description here

藍色的框是一個FrameLayout裏。我在FrameLayout中有一個RelativeLayout。 RelativeLayout的寬度/高度爲fill_parent,FrameLayout的寬度爲fill_parent,高度爲445dp,因爲這是從父級底部到TabWidget底部的高度。

那麼,我怎樣才能設置FrameLayout總是去只有標籤?(我需要它來調整大小以適應任何DPI /屏幕尺寸它顯示在)

XML:

<?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="fill_parent" 
android:layout_height="fill_parent"> 

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

<FrameLayout 
    android:id="@android:id/tabcontent" 
    android:layout_width="fill_parent" 
    android:layout_height="445dp" 
    android:layout_gravity="bottom" > 

    <RelativeLayout 
android:id="@+id/layout" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:layout_gravity="bottom" > 

    </RelativeLayout> 


</FrameLayout> 




</TabHost> 

回答

1

這將工作....

android:layout_marginTop="63dp" 
android:layout_height="fill_parent" 
+0

謝謝你,那工作。 – Cole 2012-03-09 22:45:20