【发布时间】:2017-07-25 17:56:02
【问题描述】:
我在屏幕上有两个视图,一个 Google 地图片段和一个不同的自定义片段。在自定义片段出现在屏幕上之前,谷歌地图是全屏的,这很好。一旦新片段出现在屏幕底部,我想调整谷歌地图的大小,使其仅占用新片段未使用的可用空间。
即。在新片段之前
|----------------|
| |
| |
| |
| |
| Map |
| |
| |
| |
| |
| |
| |
|----------------|
在新片段之后
|----------------|
| |
| |
| |
| Map |
| |
| |
| |
|----------------| <-- Map ends here
| |
| New Fragment |
| |
|----------------|
XML 文件:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout">
<android.support.design.widget.NavigationView
android:layout_width="200dp"
android:layout_height="match_parent"
app:menu="@menu/navigation_menu"
android:id="@+id/navigation_menu"
android:layout_gravity="start">
</android.support.design.widget.NavigationView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.damia.placefinder.activities.MapsActivity" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="300dp"
android:id="@+id/container_locations"
android:layout_alignParentBottom="true"
android:background="@color/cardview_light_background"
android:visibility="gone">
</FrameLayout>
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>
谢谢
【问题讨论】:
标签: android google-maps android-layout android-fragments