嗨,我正在使用FragmentTabHost
在我的应用程序中显示一些选项卡。
选项卡将显示,但不会显示在底部。这是我的活动布局代码
<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>
我用来显示的代码取自android文档。我的问题是标签总是在上面,而不是在下面
最佳答案
实际上,这是违反android设计准则的,因为在底部有软/硬按钮,比如back button home按钮等。
http://developer.android.com/design/patterns/pure-android.html
但是如果你坚持把它们放在最底层,你应该调整一下,下面已经有一个已经实现的
https://github.com/rameshkec85/BottomTabsFragmentTabHost