Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 在安卓系统中,我如何在地图片段下方获得自己的状态栏_Android_Google Maps_Android Linearlayout_Android Xml - Fatal编程技术网

Android 在安卓系统中,我如何在地图片段下方获得自己的状态栏

Android 在安卓系统中,我如何在地图片段下方获得自己的状态栏,android,google-maps,android-linearlayout,android-xml,Android,Google Maps,Android Linearlayout,Android Xml,我试图让谷歌地图占据几乎所有的屏幕,但我希望我自己的全宽状态栏位于地图下方的屏幕底部。为此,我尝试使用LinearLayout,状态栏使用TextView。但是,状态栏从未出现。我的xml是 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/activity_main" android:layout_width="match_parent"

我试图让谷歌地图占据几乎所有的屏幕,但我希望我自己的全宽状态栏位于地图下方的屏幕底部。为此,我尝试使用LinearLayout,状态栏使用TextView。但是,状态栏从未出现。我的xml是

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <fragment
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        class="com.google.android.gms.maps.MapFragment" />             

    <TextView 
        android:id="@+id/main_status_bar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:padding = "4sp"
        android:gravity="left|center_vertical"
        android:text="Statusbar"
        />

</LinearLayout>

我做错了什么

PS:我有点担心的是,
android只有两种选择:布局高度
,即
“包装内容”
“匹配父项”
。这似乎不允许状态栏的规格是它所需要的大小(即,
android:layout\u height=“wrap\u content”
),其余部分由地图来完成,因为对我来说,使用
android:layout\u height=“match\u parent”
从逻辑上来说意味着没有其他空间。然而,即使使用

android:layout\u height=“wrap\u content”

因为两者似乎都不起作用

我做错了什么

如果让我猜,
wrap\u content
MapFragment
不起作用。除此之外,您的布局并没有指定您显然想要的内容

我有点担心android只有两种选择:布局高度,即“包装内容”和“匹配父项”

android:layout\u height有无限多的选择,因为它也可以采用维度,并且有无限多的正整数

这似乎不允许状态栏的规格达到它所需的大小(即android:layout\u height=“wrap\u content”),其余部分则由地图决定


将片段的
android:layout\u height
设置为
0dp
,并将其
android:layout\u weight=“1”
。这告诉Android为固有高度分配0个像素,但也给它所有剩余的像素(因为默认情况下条形图的权重为0)。这将导致
MapFragment
占据底部栏未占用的所有空间。

我不知道您想对状态栏做什么:但是
uiOptions=“splitActionBarWhenNarrow”
(清单中)是否可以帮到您?如果你不想在那里导航和做其他事情,你可以这样做:)谢谢@tenhouse的建议,但是答案表明我的xml是错误的。非常感谢,这很有效:-)。如果我的问题是stuipd,那么很抱歉,我对这个Android xml非常笨拙stuff@Stochastically:这个问题并不愚蠢,尽管措辞表明您对自己关于
android:layout\u height
的有效值的断言相当自信。我需要打电话给你,以便给你答案(最后一段)。我本可以更温和地处理这件事的,我为任何弄皱的羽毛道歉。我进一步道歉,如果暗示你可能确实有羽毛激怒了他们。:-)