Bora
Bora

Reputation: 1925

Tabs not coming in bottom when using fragment tab host

Hi I am using FragmentTabHost to display some tabs in my application. Tabs are displayed but not appearing at the bottom. Here is my layout code for activity

<android.support.v4.app.FragmentTabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent">

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

    <TabWidget
        android:id="@android:id/tabs"
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0"/>

    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_weight="0"/>

    <FrameLayout
        android:id="@+android:id/realtabcontent"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"/>

</LinearLayout>

The code I used to display is taken from Android documentation. My problem is tabs are always on top and they're not appearing at the bottom

Upvotes: 2

Views: 2580

Answers (2)

Alexander B
Alexander B

Reputation: 3510

Try this: https://stackoverflow.com/a/23150258/2765497 simple chenge TabHost to android.support.v4.app.FragmentTabHost for support Api<11

Upvotes: 1

Onur A.
Onur A.

Reputation: 3017

Actually it's against Android Design Guideline since at bottom there are soft/hard buttons like back button home button etc.

http://developer.android.com/design/patterns/pure-android.html

But if you insist on to put them at the bottom, you should tweak it, there have been an already implemented one below https://github.com/rameshkec85/BottomTabsFragmentTabHost

Upvotes: 2

Related Questions