简体   繁体   English

如何允许半个SupportMapFragment和半线性布局?

[英]How to allow for half SupportMapFragment and half linear layout?

I have added a Google maps fragment to an an xml layout but it takes up the full screen.Does anyone know if its possible to allow for the layout dimensions of the fragment to take u half of the screen and the other half a linear or even relative layout? 我已将谷歌地图片段添加到xml布局中,但它占据了整个屏幕。是否有人知道是否可以允许片段的布局尺寸占用屏幕的一半而另一半是线性或均匀的相对布局? I came up with this mock up to illustrate my meaning.My layout code is also posted below.Can someone offer me some pointers on this issue? 我想出了这个模拟来说明我的意思。我的布局代码也发布在下面。有人能就这个问题向我提供一些指示吗?

<fragment xmlns:android="http://schemas.android.com/apk/res/android"
 android:id="@+id/map"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 class="com.google.android.gms.maps.SupportMapFragment"/>

在此输入图像描述

You can use LinearLayout with weights. 您可以将LinearLayout与权重一起使用。

  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="vertical" >

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

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="vertical" >
    </LinearLayout>

</LinearLayout>

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM