如何显示底部的标签栏,-Tab与片段 [英] How to show the Tab bar in bottom, -Tab with Fragment
问题描述
我正在开发一个基于标签的Android应用程序,我已经看到了TabActivity类去precated,而使用的片段来达到同样的,我用下面的链接,并开发了应用程序,现在我需要显示在底部标签栏,我试过一些方法,但不能让它正常工作,
的http://thepseudo$c$cr.word$p$pss.com/2011/10/04/android-tabs-the-fragment-way/
有人能帮助我在此,我的标签布局XML
<?XML版本=1.0编码=UTF-8&GT?;
< LinearLayout中的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:方向=垂直
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT>
< TabHost
机器人:ID =@机器人:ID / tabhost
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT
>
<的LinearLayout
机器人:方向=垂直
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT
> < TabWidget
机器人:ID =@机器人:ID /标签
机器人:方向=横向
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_weight =0
/> <的FrameLayout
机器人:ID =@机器人:ID / tabcontent
机器人:layout_width =0dp
机器人:layout_height =0dp
机器人:layout_weight =0/> <的FrameLayout
机器人:ID =@ +安卓:ID / realtabcontent
机器人:layout_width =FILL_PARENT
机器人:layout_height =0dp
机器人:layout_weight =1/>
< / LinearLayout中>
< / TabHost>
< / LinearLayout中>
首先摆脱了外部的LinearLayout的,也没用。
然后把你的TabWidget在你内心的LinearLayout的最后一个位置,你就大功告成了。
I'm developing a tab based android application,I have seen that "TabActivity" class is deprecated and instead use the Fragment to achieve the same, I used the following link and develop my application, now I need to show the tab bar in the bottom, I tried few ways but could not get it work correctly,
http://thepseudocoder.wordpress.com/2011/10/04/android-tabs-the-fragment-way/
Can some one help me on this, my tab layout 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>
First get rid of the outer LinearLayout, it's useless. Then put your TabWidget in last position of your inner LinearLayout and you're done.
这篇关于如何显示底部的标签栏,-Tab与片段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!