在我的一个活动上遇到地图片段问题,基本上我创建了一个底部导航视图,无论我做什么,我的地图片段都会在我的底部导航视图后面。我不确定如何让它尊重我的布局并坐在我的底部导航视图上方。
我有一个包含其中所有内容的滚动视图,包括地图片段,然后是滚动视图外部的底部导航视图,以便它保持固定在布局的底部。
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:fitsSystemWindows="true">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/scrollview"
android:orientation="vertical">
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- My content -->
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:layout_below="@+id/details"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="300dp"
map:cameraZoom = "15"
map:uiZoomControls = "true" />
</RelativeLayout>
</ScrollView>
<LinearLayout
android:id="@+id/toolbar_footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:layout_alignParentBottom="true"
android:orientation="vertical"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.design.widget.BottomNavigationView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/bottom_toolbar"
android:background="@drawable/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start"
app:menu="@menu/toolbar_item" />
</LinearLayout>
</RelativeLayout>
答案 0 :(得分:1)
更新代码
<强>机器人:layout_above = “@ + ID / toolbar_footer”强>
...
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/scrollview"
android:orientation="vertical"
android:layout_above="@+id/toolbar_footer"
android:fillViewport="true">
...