Android 谷歌地图在点击MapView v2后打开

Android 谷歌地图在点击MapView v2后打开,android,google-maps-api-2,Android,Google Maps Api 2,我一直在努力使地图视图不可点击。我希望有人也面对这个问题 这是我的密码: <com.google.android.gms.maps.MapView android:id="@+id/map_header" android:layout_width="fill_parent" android:layout_height="90dp" android:clickable="false" android:longClickable="false" map:li

我一直在努力使地图视图不可点击。我希望有人也面对这个问题

这是我的密码:

<com.google.android.gms.maps.MapView
   android:id="@+id/map_header"
   android:layout_width="fill_parent"
   android:layout_height="90dp"
   android:clickable="false"
   android:longClickable="false"
   map:liteMode="true"
   map:mapType="normal"
/>
只有在使用lite模式时才会发生这种情况。在正常模式下,它不可单击


提前感谢:)

设置
mapView.setClickable(false)
getmapsync
回调(
onMapReady
方法)中

考虑到您正在活动中使用它。您可以执行以下操作

public class MapActivity extends AppCompatActivity implements OnMapReadyCallback {

    MapView mapView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_map);

        // Gets the MapView from the XML layout and creates it
        mapView = (MapView) v.findViewById(R.id.map_header);
        mapView.setClickable(false);
        mapView.getMapAsync(this);
    }

    @Override
    public void onMapReady(GoogleMap map) {
        // Perform action on your map. E.g. Display marker 
    }
}

我也有这个问题。解决此问题的方法是覆盖onmaplick侦听器,如下所示:

mMap.setOnMapClickListener(新的GoogleMap.OnMapClickListener(){
@凌驾
公共无效的点击(LatLng LatLng){
//什么都不做,我们想阻止谷歌地图的发布
}
});
public class MapActivity extends AppCompatActivity implements OnMapReadyCallback {

    MapView mapView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_map);

        // Gets the MapView from the XML layout and creates it
        mapView = (MapView) v.findViewById(R.id.map_header);
        mapView.setClickable(false);
        mapView.getMapAsync(this);
    }

    @Override
    public void onMapReady(GoogleMap map) {
        // Perform action on your map. E.g. Display marker 
    }
}