底部表格内的Google Map

问题描述

我想创建一个视图,其中希望在BottomSheetFragment内显示Google地图。目前,我的视图还响应用户更改底页状态的手势,但是我要求手势只能在地图上使用(例如,用于地图平移)。我只希望closeBottomSheetLinearLayout更改滚动时的底部工作表状态。有可能吗?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:background="@color/colorGray"
    android:elevation="10dp"
    android:orientation="vertical">

    <LinearLayout
        android:id="@+id/closeBottomSheetLinearLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:background="@android:color/white">

        ...

    </LinearLayout>

    <pl.renesans.renesans.SquareLinearLayout
        android:id="@+id/mapLayout"
        android:layout_width="match_parent"
        android:layout_height="0dp">

        <fragment
            android:id="@+id/map"
            android:name="com.google.android.gms.maps.SupportMapFragment"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            tools:context=".tour.TourActivity"/>

    </pl.renesans.renesans.SquareLinearLayout>

</LinearLayout>

预先感谢

解决方法

我必须以这种方式实现onInterceptTouchEvent(MotionEvent ev)并有效。

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
    switch (ev.getAction()) {
        case MotionEvent.ACTION_DOWN:
            getParent().requestDisallowInterceptTouchEvent(true);
            break;
        case MotionEvent.ACTION_UP:
            getParent().requestDisallowInterceptTouchEvent(false);
            break;
        default:
            break;
    }
    return super.onInterceptTouchEvent(ev);
}

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...