Cole
Cole

Reputation: 2815

How to keep layouts from overlapping TabWidget?

I have a layout with a TabHost/TabWidget like this:

enter image description here

The blue box is a FrameLayout. I have a RelativeLayout inside the FrameLayout. 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.

So how can I set the FrameLayout to always go only up to the Tabs? (I need it to resize to fit whatever DPI/screen size it's being displayed in)

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>

Upvotes: 0

Views: 1060

Answers (1)

Chirag Patel
Chirag Patel

Reputation: 11508

This will work....

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

Upvotes: 1

Related Questions