将标签栏在Android的屏幕上方 [英] Move Tab Bar to top of the screen in android

查看:155
本文介绍了将标签栏在Android的屏幕上方的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面我列出的XML code.That显示在屏幕底部的标签栏。

layout_home.xml

 <?XML版本=1.0编码=UTF-8&GT?;
< LinearLayout中的xmlns:机器人=htt​​p://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>        < RelativeLayout的
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =FILL_PARENT>            <的FrameLayout
                机器人:ID =@机器人:ID / tabcontent
                机器人:layout_width =FILL_PARENT
                机器人:layout_height =FILL_PARENT
                机器人:layout_above =@机器人:ID /制表符>                <的FrameLayout
                    机器人:ID =@ + ID / tab_home
                    机器人:layout_width =FILL_PARENT
                    机器人:layout_height =FILL_PARENT/>                <的FrameLayout
                    机器人:ID =@ + ID / tab_video
                    机器人:layout_width =FILL_PARENT
                    机器人:layout_height =FILL_PARENT/>                <的FrameLayout
                    机器人:ID =@ + ID / tab_audio
                    机器人:layout_width =FILL_PARENT
                    机器人:layout_height =FILL_PARENT>
                < /&的FrameLayout GT;                <的FrameLayout
                    机器人:ID =@ + ID / tab_blog
                    机器人:layout_width =FILL_PARENT
                    机器人:layout_height =FILL_PARENT>
                < /&的FrameLayout GT;                <的FrameLayout
                    机器人:ID =@ + ID / tab_gal
                    机器人:layout_width =FILL_PARENT
                    机器人:layout_height =FILL_PARENT>
                < /&的FrameLayout GT;                <的FrameLayout
                    机器人:ID =@ + ID / tab_more
                    机器人:layout_width =FILL_PARENT
                    机器人:layout_height =FILL_PARENT>
                < /&的FrameLayout GT;
            < /&的FrameLayout GT;            < TabWidget
                机器人:ID =@机器人:ID /标签
                机器人:layout_width =FILL_PARENT
                机器人:layout_height =WRAP_CONTENT
                机器人:layout_alignParentBottom =真
                机器人:背景=@绘制/ top_bar
                机器人:分=@空/>            < - 安卓!后台=#d8e49c - >
        < / RelativeLayout的>
    < / TabHost>< / LinearLayout中>

截图:

我需要移动标签栏的screen.Thanks顶部提前。


解决方案

 这是否对你的工作....< XML版本=1.0编码=UTF-8&GT?;
< LinearLayout中的xmlns:机器人=htt​​p://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>        < RelativeLayout的
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =FILL_PARENT>            <的FrameLayout
                机器人:ID =@机器人:ID / tabcontent
                机器人:layout_width =FILL_PARENT
                机器人:layout_height =FILL_PARENT
                机器人:layout_below =@机器人:ID /制表符>                <的FrameLayout
                    机器人:ID =@ + ID / tab_home
                    机器人:layout_width =FILL_PARENT
                    机器人:layout_height =FILL_PARENT/>                <的FrameLayout
                    机器人:ID =@ + ID / tab_video
                    机器人:layout_width =FILL_PARENT
                    机器人:layout_height =FILL_PARENT/>                <的FrameLayout
                    机器人:ID =@ + ID / tab_audio
                    机器人:layout_width =FILL_PARENT
                    机器人:layout_height =FILL_PARENT>
                < /&的FrameLayout GT;                <的FrameLayout
                    机器人:ID =@ + ID / tab_blog
                    机器人:layout_width =FILL_PARENT
                    机器人:layout_height =FILL_PARENT>
                < /&的FrameLayout GT;                <的FrameLayout
                    机器人:ID =@ + ID / tab_gal
                    机器人:layout_width =FILL_PARENT
                    机器人:layout_height =FILL_PARENT>
                < /&的FrameLayout GT;                <的FrameLayout
                    机器人:ID =@ + ID / tab_more
                    机器人:layout_width =FILL_PARENT
                    机器人:layout_height =FILL_PARENT>
                < /&的FrameLayout GT;
            < /&的FrameLayout GT;            < TabWidget
                机器人:ID =@机器人:ID /标签
                机器人:layout_width =FILL_PARENT
                机器人:layout_height =WRAP_CONTENT
                机器人:layout_alignParentTop =真
                机器人:背景=@绘制/ ic_launcher
                机器人:分=@空/>            < - 安卓!后台=#d8e49c - >
        < / RelativeLayout的>
    < / TabHost>< / LinearLayout中>

Below I listed the xml code.That shows the tab bar at the bottom of the screen.

layout_home.xml

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

    <TabHost
        android:id="@android:id/tabhost"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" >

            <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_above="@android:id/tabs" >

                <FrameLayout
                    android:id="@+id/tab_home"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent" />

                <FrameLayout
                    android:id="@+id/tab_video"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent" />

                <FrameLayout
                    android:id="@+id/tab_audio"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent" >
                </FrameLayout>

                <FrameLayout
                    android:id="@+id/tab_blog"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent" >
                </FrameLayout>

                <FrameLayout
                    android:id="@+id/tab_gal"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent" >
                </FrameLayout>

                <FrameLayout
                    android:id="@+id/tab_more"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent" >
                </FrameLayout>
            </FrameLayout>

            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:background="@drawable/top_bar"
                android:divider="@null" />

            <!-- android:background="#d8e49c" -->
        </RelativeLayout>
    </TabHost>

</LinearLayout>

Screenshot:

I need to move that tab bar to top of the screen.Thanks in advance.

解决方案

Does this work for you....

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

    <TabHost
        android:id="@android:id/tabhost"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" >

            <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_below="@android:id/tabs" >

                <FrameLayout
                    android:id="@+id/tab_home"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent" />

                <FrameLayout
                    android:id="@+id/tab_video"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent" />

                <FrameLayout
                    android:id="@+id/tab_audio"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent" >
                </FrameLayout>

                <FrameLayout
                    android:id="@+id/tab_blog"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent" >
                </FrameLayout>

                <FrameLayout
                    android:id="@+id/tab_gal"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent" >
                </FrameLayout>

                <FrameLayout
                    android:id="@+id/tab_more"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent" >
                </FrameLayout>
            </FrameLayout>

            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:background="@drawable/ic_launcher"
                android:divider="@null" />

            <!-- android:background="#d8e49c" -->
        </RelativeLayout>
    </TabHost>

</LinearLayout>

这篇关于将标签栏在Android的屏幕上方的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆