【问题标题】:Tabs at bottom with mapview on top底部的标签,顶部的地图视图
【发布时间】:2014-04-24 21:09:41
【问题描述】:

大家好..

我正在制作一个带有 tabview 的应用程序,其中一个选项卡中嵌入了 mapview。 但是我希望 tabview 位于底部而不是顶部,当我将重力或 layout_marginBottom 设置为 true 时,它​​会消失,并且不再在屏幕上可见。

这是选项卡视图活动的 xml 文件

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/tabhost"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

        <TabWidget
        android:id="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />

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

            <RelativeLayout
            android:id="@+id/emptylayout1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical" />

        </FrameLayout>
    </LinearLayout>

</TabHost>

任何想法如何让标签底部仍然可见??

【问题讨论】:

    标签: android xml android-mapview tabview


    【解决方案1】:
    <?xml version="1.0" encoding="utf-8"?>
    <TabHost xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@android:id/tabhost"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" 
        android:background="@android:color/white">
    
        <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:padding="5dp" />
    
            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true" />
        </RelativeLayout>
    
    </TabHost>
    

    这对我有用。将 tabcontent FrameLayout 放在 TabWidget 上方。请尝试一下并告诉我。

    【讨论】:

    • 你是个天才.. :D 非常感谢,确实有效,但我还有一个问题,地图没有填满整个屏幕,就像有一个白边??无论如何要解决这个问题??
    • android:background="@android:color/white" 可能是白边的原因。还可以尝试从 FrameLayout 中删除 android:padding="5dp"。
    • 谢谢,解决了这个问题..它没有填充,不再有边缘..非常感谢它对我帮助很大:D
    • 抱歉不知道怎么做,我在stackoverflow.com的第一篇文章:D
    • AmY有什么可以请教的吗??
    【解决方案2】:

    我已经这样做了......

    <?xml version="1.0" encoding="utf-8"?>
    <TabHost xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@android:id/tabhost"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    
        <RelativeLayout
            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="match_parent"
                android:layout_above="@android:id/tabs" />
    
            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true" />
        </RelativeLayout>
    
    </TabHost>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多