【问题标题】:How to keep layouts from overlapping TabWidget?如何防止布局重叠 TabWidget?
【发布时间】:2012-03-09 02:05:33
【问题描述】:

我有一个带有 TabHost/TabWidget 的布局,如下所示:

蓝色框是 FrameLayout。我在 FrameLayout 中有一个 RelativeLayout。 RelativeLayout 的宽度/高度位于 fill_parent,而 FrameLayout 的宽度/高度位于 fill_parent 宽度和 445dp 高度,因为这是从 Parent 底部到 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>

【问题讨论】:

    标签: android layout android-layout tabs android-tabhost


    【解决方案1】:

    这会起作用....

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

    【讨论】:

      猜你喜欢
      • 2017-07-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多