我有一个带有地图和自定义视图的活动:
我想在此视图上自由拖动图像标记,因此我可以在4个标记之间追踪一条线。
与谷歌地图的叠加标记类似。但是地图标记不太好,因为我必须按住,才能启用拖动。我喜欢更自由的行为。
<FrameLayout 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"
tools:context=".MapFragment">
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<br.com.alexpfx.tracker.soccer.view.FieldFrame
android:id="@+id/fieldFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal|center_vertical"
android:layout_weight="1"
android:background="#80000000"
android:backgroundTintMode="multiply"
android:visibility="visible"
/>
答案 0 :(得分:0)
您可以从Dragging and Scaling中提供的可用触摸手势中进行选择,这些触摸手势是使用onTouchEvent()
来拦截触摸事件的。
如上所述,您可以使用的触摸手势如下:
可以在给定的文档中找到更多信息和示例代码段。