Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/303.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何知道我在osmdroid映射中按下的标记?_Java_Marker_Osmdroid - Fatal编程技术网

Java 如何知道我在osmdroid映射中按下的标记?

Java 如何知道我在osmdroid映射中按下的标记?,java,marker,osmdroid,Java,Marker,Osmdroid,我想知道如何控制我在osmdroid上单击的标记 List<Marker> markerList_OSM = new ArrayList<>(); 现在,我如何控制压力机标记?长压和短压 在我使用的谷歌地图中: map.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() { @SuppressLint("InflateParams") public boolean

我想知道如何控制我在osmdroid上单击的标记

List<Marker> markerList_OSM = new ArrayList<>();
现在,我如何控制压力机标记?长压和短压

在我使用的谷歌地图中:

map.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {
        @SuppressLint("InflateParams")
        public boolean onMarkerClick(final Marker markerSelect) {
......
......
......
return false;
        }
    });
谢谢。

在标记器实例上使用

coorLoad.setOnMarkerClickListener(new Marker.OnMarkerClickListener() {
    boolean onMarkerClick(Marker marker, MapView mapView) {
        ....
    }
});

要控制长按,必须对Marker类进行子类化,并实现onLongPress方法:

@Override public boolean onLongPress(final MotionEvent event, final MapView mapView) {
        boolean touched = hitTest(event, mapView);
        if (touched){
           //here, do whatever you want
           //....
        }
        return touched;
    }

非常感谢你。我在每个标记器中都实现了setonmarkerclicklister,它可以工作。但是,我如何控制长按?
@Override public boolean onLongPress(final MotionEvent event, final MapView mapView) {
        boolean touched = hitTest(event, mapView);
        if (touched){
           //here, do whatever you want
           //....
        }
        return touched;
    }