Here's the simplest, most robust, and scalable solution to get tabs on the bottom of the screen.
- In your vertical LinearLayout, put the FrameLayout above the TabWidget
- Set *layout_width* to *wrap_content* on both FrameLayout and TabWidget
- Set FrameLayout's *android:layout_weight="1"*
- Set TabWidget's *android:layout_weight="0"* (0 is default, but for emphasis, readability, etc)
Full code:
<?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"
android:padding="5dp">
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:layout_weight="1"/>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0"/>
</LinearLayout>
</TabHost>
I haven't yet figured out how to move that grey underlining divider below the tabs above them, however.