首页 > 解决方案 > BottomSheetBehaviour 布局中的 MapLayout 上下滚动 Map Activity 时出错

问题描述

有没有办法BottomScrollBehaviour实现只有具有拖动功能但没有 NestedScrollView 的内部布局。

我问这个问题是因为我使用的是Fragment MapLayout内部NestedScrollView布局。

因此,当在地图上拖动leftright反之时,会发生什么情况.

这是我的布局:

<androidx.coordinatorlayout.widget.CoordinatorLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <androidx.core.widget.NestedScrollView
        android:padding="10dp"
        android:id="@+id/homeMap"
        android:layout_marginTop="100dp"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:behavior_hideable="false"
        android:background="#75A359"
        android:fillViewport="true"
        app:behavior_peekHeight="0dp"
        app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">

        <androidx.cardview.widget.CardView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:cardCornerRadius="15dp">

            <include layout="@layout/our_work"/> <!-- My Map Activity-->

        </androidx.cardview.widget.CardView>

    </androidx.core.widget.NestedScrollView>

</androidx.coordinatorlayout.widget.CoordinatorLayout>

那么有没有一种方法可以使用地图布局,因为我们通常使用谷歌地图向上、向下、向右和向左拖动并查看位置,因为在我的情况下,我无法向上和向下拖动,反之亦然但是当我在 BottomSheetBehaviour 中使用时,我可以从左向右拖动,反之亦然。而且我必须在 BottomSheetBehaviour 中使用它NestedScrollView

有什么专长吗?

标签: androidgoogle-mapsandroid-layoutandroid-fragmentsbottom-sheet

解决方案


推荐阅读