Android 底页滚动问题
我使用的是Android 底页滚动问题,android,maps,bottom-sheet,Android,Maps,Bottom Sheet,我使用的是底片(bs)和谷歌地图,我需要让bs和谷歌地图大小合适 然后,当bs展开时,地图将以小尺寸显示,当bs折叠时,地图将以原始尺寸显示 先谢谢你 这是课程和布局 ConstraintLayout linearLayoutBSheet = view.findViewById(R.id.bottomSheet); bottomSheetBehavior = BottomSheetBehavior.from(linearLayoutBSheet); bottomSheetBeh
底片(bs)和谷歌地图,我需要让bs和谷歌地图大小合适
然后,当bs展开时,地图将以小尺寸显示,当bs折叠时,地图将以原始尺寸显示
先谢谢你
这是课程和布局
ConstraintLayout linearLayoutBSheet = view.findViewById(R.id.bottomSheet);
bottomSheetBehavior = BottomSheetBehavior.from(linearLayoutBSheet);
bottomSheetBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
@Override
public void onStateChanged(@NonNull View bottomSheet, int newState) {
switch (newState){
case BottomSheetBehavior.STATE_COLLAPSED:
break;
case BottomSheetBehavior.STATE_DRAGGING:
break;
case BottomSheetBehavior.STATE_EXPANDED:
break;
}
}
地图布局
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".z_version2.MenuFragments.UnitMap.view.UnitMapViewImpl">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintMap"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<com.google.android.gms.maps.MapView
android:id="@+id/map"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/toolbar_maps" />
</androidx.constraintlayout.widget.ConstraintLayout>
<include
layout="@layout/bottom_sheet_map"
android:visibility="visible" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
底页布局
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/bottomSheet"
android:layout_width="match_parent"
android:layout_height="400dp"
android:background="@drawable/round_bottom_shet"
app:behavior_peekHeight="150dp"
app:layout_behavior="@string/bottom_sheet_behavior">
<androidx.core.widget.NestedScrollView
android:id="@+id/nestedScrollViewVehiclesList"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
在成功更改底部表单后加载Google地图。您具体有什么问题?没有达到我需要的效果,bs会展开,但地图不会折叠,我不知道我需要什么属性来实现该效果