如何在底部显示标签栏,-Tab with Fragment

Sam*_*Sam 4 android android-layout

我正在开发基于选项卡的android应用程序,我已经看到"TabActivity"类已被弃用,而是使用Fragment来实现相同的功能,我使用以下链接开发我的应用程序,现在我需要显示标签栏中的底部,我尝试了几种方法,但无法使其正常工作,

http://thepseudocoder.wordpress.com/2011/10/04/android-tabs-the-fragment-way/

有人可以帮我这个,我的标签布局xml

  <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
    <TabHost
        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"
            >

            <TabWidget
                android:id="@android:id/tabs"
                android:orientation="horizontal"
                android:layout_width="fill_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="fill_parent"
                android:layout_height="0dp"
                android:layout_weight="1"/>
        </LinearLayout>
    </TabHost>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

gde*_*nte 9

首先摆脱外部的LinearLayout,它没用.然后将TabWidget放在内部LinearLayout的最后位置,然后就完成了.