Я использую BottomSheet
(bs) и карты Google. Мне нужно, чтобы размеры bs и googlemaps соответствовали размерам
Затем, когда 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">