Skobbler。 当我设置自己的注释时,onAnnotationSelected未被调用

我使用Skobbler Maps。 当我将自己的图标设置为注释时,不会调用onAnnotationSelected。 当我设置默认图标( annotation.setAnnotationType(SKAnnotation.SK_ANNOTATION_TYPE_PURPLE); )时,它工作正常。 我做错了什么?

 cursor = dataBaseHelper.getWritableDatabase().rawQuery(stringBuilder.toString(), null); int count = cursor.getCount(); for (int i = 0; i < count; i++) { if (cursor.moveToPosition(i)) { SKAnnotation annotation = new SKAnnotation(); annotation.setUniqueID(cursor.getInt(cursor.getColumnIndex(1))); annotation.setLocation(new SKCoordinate(cursor.getDouble(cursor.getColumnIndex(2)), cursor.getDouble(cursor.getColumnIndex(3)))); annotation.setMininumZoomLevel(5); annotation.setImageSize(32); annotation.setImagePath(imagePath+cursor.getString(cursor.getColumnIndex(4))); mapView.addAnnotation(annotation, SKAnimationSettings.ANIMATION_NONE); 

您需要设置图像的中心点 – 点击注释将取决于此值。

 // add an annotation with an image file SKAnnotation annotation = new SKAnnotation(13); annotation.setLocation(new SKCoordinate(-122.434516, 37.770712)); annotation.setMininumZoomLevel(5); DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); if (metrics.densityDpi < DisplayMetrics.DENSITY_HIGH) { // set the center point of the image - tapping on an annotation will depend on this value . Also the actual gps coordinates of the annotation will be in the center of the image. annotation.getOffset().setX(16); annotation.getOffset().setY(16); annotation.setImagePath(SKMaps.getInstance().getMapInitSettings().getMapResourcesPath() + "/.Common/poi_marker.png"); // set the size of the image in pixels annotation.setImageSize(32); } else { // set the center point of the image - tapping on an annotation will depend on this value . Also the actual gps coordinates of the annotation will be in the center of the image. annotation.getOffset().setX(32); annotation.getOffset().setY(32); annotation.setImagePath(SKMaps.getInstance().getMapInitSettings().getMapResourcesPath()+ "/.Common/poi_marker_retina.png"); // set the size of the image in pixels annotation.setImageSize(64); } mapView.addAnnotation(annotation,SKAnimationSettings.ANIMATION_NONE);