如何解决底部表格内的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);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。