skobbler(skmaps)注释与按钮

时间:2015-09-15 20:37:18

标签: android button annotations skmaps

我想在skmap上添加注释,如下所示: SKAnnotation annotation1 = new SKAnnotation(p1.id);

注释必须包含2个按钮以及相应的处理程序。 我怎么能这样做?

1 个答案:

答案 0 :(得分:0)

您可以通过在视图中添加注释来尝试,并在该视图中添加自定义按钮。 这是演示项目中的代码:

SKAnnotation annotationFromView = new SKAnnotation(15);
annotationFromView.setLocation(new SKCoordinate(-122.423573, 37.761349));
annotationFromView.setMininumZoomLevel(5);
annotationView = new SKAnnotationView();
customView =
        (RelativeLayout) ((LayoutInflater)
getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(
                R.layout.layout_custom_view, null, false);

//If width and height of the view  are not power of 2 the actual size of the
//image will be the next power of 2 of max(width,height).

annotationView.setView(customView);
annotationFromView.setAnnotationView(annotationView);
mapView.addAnnotation(annotationFromView, SKAnimationSettings.ANIMATION_NONE);