我正在尝试将Google地图放在滚动视图中,以便用户可以向下滚动其他内容以查看地图.问题是这个滚动视图占用了所有垂直触摸事件,因此地图的UI体验变得非常奇怪.
我知道在谷歌地图的V1中,您可以覆盖onTouch或setOnTouchListener以在MotionEvent.ACTION_DOWN上调用requestDisallowInterceptTouchEvent.我试图用V2实现类似的技巧无济于事.
到目前为止,我尝试过:
这些都没有解决滚动问题.我在这里错过了什么吗?如果有人在滚动视图中有一个地图的工作示例,请您分享代码示例吗?
所以我一直试图在fragment里面使用谷歌地图精简版scrollView,我无法显示地图.scrollView通过它自己移除并离开片段后,现在是时候可以看到地图了.我只是想了解为什么会这样,以及是否有可能让我的scrollView结束时显示这个片段.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.joe.goout.EventDetails">
<ImageView
android:src="@mipmap/park1"
android:layout_width="fill_parent"
android:layout_height="150dp"
android:scaleType="centerCrop"
android:adjustViewBounds="true"
android:id="@+id/imageView"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/imageView"
android:id="@+id/scrollView"
android:fillViewport="false">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Medium Text"
android:id="@+id/textView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</ScrollView>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)