底页滚动问题

问题描述 投票:0回答:1

我正在使用BottomSheet(bs)和google地图,我需要使bs和googlemap适应大小

然后,当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">
android maps bottom-sheet
1个回答
0
投票

成功更改底表后,加载googlemap。

© www.soinside.com 2019 - 2024. All rights reserved.