MMM
MMM

Reputation: 63

How to set tab in the bottom of the display in android?

I want to set one tab in the center bottom of the display.

Upvotes: 0

Views: 643

Answers (2)

nahwarang
nahwarang

Reputation: 653

Use layout_weight="0" for the TabWidget and layout_weight="1" for the content

<?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:orientation="vertical"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent">
    <FrameLayout 
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent" 
        android:layout_height="0dip"
        android:layout_weight="1" 
        android:padding="0dp"/>
    <TabWidget 
        android:id="@android:id/tabs"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:layout_weight="0"/>
</LinearLayout>
</TabHost>

Upvotes: 1

Nibha Jain
Nibha Jain

Reputation: 8141

You can do something like this :

   <TabWidget
        android:id="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignBottom = "@android:id/tabcontent"
        android:paddingLeft ="50dip"
        />

Thanks!!

Upvotes: 0

Related Questions