1

Hey people out there..

Im working on making a application with tabview where in one of the tabs is mapview embedded to. Buut i want the tabview to be at bottom and not on top, when i set the gravity or layout_marginBottom to true it disappers, and is no longer visible on the screen.

Here is the xml file for the tab view activity

<?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" >

    <LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

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

        <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

            <RelativeLayout
            android:id="@+id/emptylayout1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical" />

        </FrameLayout>
    </LinearLayout>

</TabHost>

Any ideas how to get the tabs to bottom and still visible??

Mustii1989
  • 29
  • 7

2 Answers2

3
<?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" 
    android:background="@android:color/white">

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:padding="5dp" />

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

</TabHost>

This works for me. Place the tabcontent FrameLayout above TabWidget. Please try it out and let me know.

Kannan Suresh
  • 4,573
  • 3
  • 34
  • 59
  • You are an geniiiiuuus.. :D Thanks alot, really that worked but i have one more question, the map doesnt fill the whole screen, it is like there is an white edge?? anyway to solve that problem?? – Mustii1989 Dec 08 '11 at 01:24
  • **android:background="@android:color/white"** might be the reason for the white edge. Also try by removing **android:padding="5dp"** from the FrameLayout. – Kannan Suresh Dec 08 '11 at 15:07
  • Thanks, solved the problem.. It work with out the padding, there is no edge longer.. Thanks alot it helped me very much :D – Mustii1989 Dec 08 '11 at 19:53
  • Sorry didnt know how to do it, my first post in stackoverflow.com :D – Mustii1989 Dec 12 '11 at 00:03
  • Is it possible to ask you for something AmY?? – Mustii1989 Dec 20 '11 at 12:24
  • Yes please. If it is a new question, you may please post it as a new question in stackoverflow and I'll try to help. – Kannan Suresh Dec 21 '11 at 03:57
1

I have done it like this...

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

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_above="@android:id/tabs" />

        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true" />
    </RelativeLayout>

</TabHost>
Zar E Ahmer
  • 33,936
  • 20
  • 234
  • 300