简体   繁体   English

如何防止布局重叠的TabWidget?

[英]How to keep layouts from overlapping TabWidget?

I have a layout with a TabHost/TabWidget like this: 我有一个带有TabHost / TabWidget的布局,如下所示:

在此处输入图片说明

The blue box is a FrameLayout. 蓝色框是一个FrameLayout。 I have a RelativeLayout inside the FrameLayout. 我在FrameLayout中有一个RelativeLayout。 The RelativeLayout is at fill_parent for width/height and the FrameLayout is at fill_parent width and 445dp height since that's the height from the bottom of the Parent to the bottom of the TabWidget. RelativeLayout的宽度/高度位于fill_parent处,而FrameLayout的高度为fill_parent宽度和445dp高度,因为这是从Parent底部到TabWidget底部的高度。

So how can I set the FrameLayout to always go only up to the Tabs? 那么,如何将FrameLayout设置为始终仅转到选项卡? (I need it to resize to fit whatever DPI/screen size it's being displayed in) (我需要调整它的大小以适合所显示的DPI /屏幕大小)

xml: 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>

This will work.... 这将起作用。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM