Amandeep singh
Amandeep singh

Reputation: 1883

How to set tab bar at the bottom in android?

I am using a tab bar in android.

By default, it displays at the top.

I want it to be displayed at the bottom.

Can someone please explain how to do this?

Upvotes: 7

Views: 33331

Answers (3)

Jitendra Patidar
Jitendra Patidar

Reputation: 88

<?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:padding="1dp" >

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        android:padding="5dp" >

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

Upvotes: 2

Kannan Suresh
Kannan Suresh

Reputation: 4580

Please check this link: How to align your TabHost at the bottom of the screen

Adding android:layout_alignParentBottom="true" for the TabWidget does the trick.

Upvotes: 22

Vivek
Vivek

Reputation: 4260

Just place content layout above tab widget. See following link for more info. Android: Tabs at the BOTTOM

Upvotes: 5

Related Questions