Android 当按下浮动操作按钮并点击地图时,谷歌地图检测到长时间点击
我有一个带有MapView和FloatingActionButton的视图。 当我点击并按住按钮,用另一个手指点击地图时,长点击被称为长点击而不是点击。这是为什么?如何解决 GMapView.csAndroid 当按下浮动操作按钮并点击地图时,谷歌地图检测到长时间点击,android,google-maps,android-layout,xamarin,xamarin.android,Android,Google Maps,Android Layout,Xamarin,Xamarin.android,我有一个带有MapView和FloatingActionButton的视图。 当我点击并按住按钮,用另一个手指点击地图时,长点击被称为长点击而不是点击。这是为什么?如何解决 GMapView.cs public class GMapView : BaseFragment<MapViewModel>, IOnMapReadyCallback { private GoogleMap _googleMap; // some more code public vo
public class GMapView : BaseFragment<MapViewModel>, IOnMapReadyCallback
{
private GoogleMap _googleMap;
// some more code
public void OnMapReady(GoogleMap googleMap)
{
_googleMap = googleMap;
_googleMap.MapLongClick += _googleMap_MapLongClick;
_googleMap.MapClick += _googleMap_MapClick;
}
private void _googleMap_MapClick(object sender, MapClickEventArgs e)
{
}
private async void _googleMap_MapLongClick(object sender, MapLongClickEventArgs e)
{
}
}
public类GMapView:BaseFragment,IOnMapReadyCallback
{
私人谷歌地图(GoogleMap);;
//还有代码吗
4月1日公开作废(谷歌地图谷歌地图)
{
_谷歌地图=谷歌地图;
_googleMap.MapLongClick+=\u googleMap\u MapLongClick;
_googleMap.MapClick+=\u googleMap\u MapClick;
}
私有void\u googleMap\u MapClick(对象发送者,MapClickEventArgs e)
{
}
私有异步void\u googleMap\u MapLongClick(对象发送方,MapLongClickEventArgs e)
{
}
}
GMapView.axml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.google.android.gms.maps.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right">
<FloatingActionButton
android:id="@+id/myLocalization"
local:srcCompat="@drawable/icon_my_location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/standard_margin"
local:MvxBind="Click MyLocationCommand; Allowed IsLocationEnabled" />
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
项目中的MapView版本是什么?我测试了你的代码,效果很好。在我的项目中,长点击事件是\u googleMap.LongClick+=\u googleMap\u LongClick代码>这是一个nuget Xamarin.GooglePlayServices.Maps 71.1600.0你能分享你的样本吗?这样我就可以测试它了。它是商业性的,所以我不能。我已经看到您的活动名称不同。