相关疑难解决方法(0)

ScrollView中的Google Maps API v2 SupportMapFragment - 用户无法垂直滚动地图

我正在尝试将Google地图放在滚动视图中,以便用户可以向下滚动其他内容以查看地图.问题是这个滚动视图占用了所有垂直触摸事件,因此地图的UI体验变得非常奇怪.

我知道在谷歌地图的V1中,您可以覆盖onTouch或setOnTouchListener以在MotionEvent.ACTION_DOWN上调用requestDisallowInterceptTouchEvent.我试图用V2实现类似的技巧无济于事.

到目前为止,我尝试过:

  • 覆盖SupportMapFragment,在onCreateView中,为View设置触摸侦听器
  • 调用SupportMapFragment实例的.getView(),然后调用setOnTouchListener
  • 环绕相对布局或框架布局,使用透明视图或图像视图遮罩片段

这些都没有解决滚动问题.我在这里错过了什么吗?如果有人在滚动视图中有一个地图的工作示例,请您分享代码示例吗?

android scala google-maps-android-api-2

51
推荐指数
4
解决办法
2万
查看次数

在scrollView里面的谷歌地图片段

所以我一直试图在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)

android

8
推荐指数
2
解决办法
1518
查看次数

标签 统计

android ×2

google-maps-android-api-2 ×1

scala ×1