Android 如何允许半支持MapFragment和半线性布局?

Android 如何允许半支持MapFragment和半线性布局?,android,android-layout,google-maps-api-3,android-fragments,Android,Android Layout,Google Maps Api 3,Android Fragments,我在一个xml布局中添加了一个Google maps片段,但它占据了整个屏幕。有人知道是否可以允许片段的布局维度占据屏幕的一半,而另一半是线性甚至是相对布局?我制作了这个模型来说明我的意思。我的布局代码也发布在下面。有人能给我一些关于这个问题的建议吗 <fragment xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/map" android:layout_width="match_

我在一个xml布局中添加了一个Google maps片段,但它占据了整个屏幕。有人知道是否可以允许片段的布局维度占据屏幕的一半,而另一半是线性甚至是相对布局?我制作了这个模型来说明我的意思。我的布局代码也发布在下面。有人能给我一些关于这个问题的建议吗

<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"/>


您可以使用带权重的线性布局

  <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>


是否可以在片段下方的文本框中输入目的地,并且片段将显示从当前位置到输入目的地的路线?或者这不是使用谷歌地图api v3大声说出来的?我很好奇,因为我在某个地方读到,用它来指路不是大声说的。@BrianJ对此一无所知。它的api v2实际上很好,我认为v2已经被弃用了?@BrianJ否@BrianJ它可能与地图apiv2顶部显示从当前位置到目的地的路线有关