FragmentTabHost bottom TabWidget

Hello How I can create bottom TabWidget in FragmentTabHost ? My xml looks line this:
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout
    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="0dp"
        android:layout_weight="1" >

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

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

But my TabWidget is still at the top.

I came up with this solution after six hrs effort on it..
a solution is
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

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


This a google 's bug, google say
 /** This is a helper class that implements a generic mechanism for
 * associating fragments with the tabs in a tab host. It relies on a trick.
 * Normally a tab host has a simple API for supplying a View or Intent that
 * each tab will show.This is not sufficient for switching between
 * fragments. So instead we make the content part of the tab host 0dp high
 * (it is not shown) and the TabManager supplies its own dummy view to show
 * as the tab content. It listens to changes in tabs, and takes care of
 * switch to the correct fragment shown in a separate content area whenever
 * the selected tab changes.
 */

Sedcond solution,

可以说得再宽泛点,你想在layout布局文件上改变它的任意一点布局,你会发现。。。都是徒劳的。——因为Google源码里面存在bug,bug在于:android.support.v4.app.FragmentTabHost.java源码里有一段(155行到177行)的功能是判断如果用户没有设置关于FragmentTabHost的布局文件,就采用默认布局(即TabWidget在最上面),但是这里这个判断的函数永远都是null,就是说它只会采用默认布局,这里是个Bug。

解决办法就是:

 

  1. 把那个FramgentTabHost.java文件复制到自己的工程下面
  2. 手动地把155行到177行注释掉(这样就会读取自己设置的布局了)
  3. 将所有引用到android.support.v4.app.FragmentTabHost的地方都改成引用这个复制的文件,包括上面xml布局文件的根标签