Skobbler Android 无法为自定义 SKAnnotationView 设置动画

Skobbler Android Cannot Animate custom SKAnnotationView

如何为具有自定义视图的 SKAnnotationView 制作动画。我已经正确地给它充气,它正确地显示为:

    SKAnnotation annotationFromView = new SKAnnotation(11);
    annotationFromView.setLocation(new SKCoordinate(-122.423573, 37.761349));
    annotationFromView.setMininumZoomLevel(5);
    SKAnnotationView 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);

单击时,我想让它不可见。我得到了适当的 RelativeLayout 并且它是正确的实例,但是它不会改变动画状态。为什么实例是正确的而不是 null 但动画 alpha 更改没有执行?

    @Override
    public void onAnnotationSelected(final SKAnnotation annotation) {
        RelativeLayout layout = (RelativeLayout)annotation.getAnnotationView().getView();
                layout.setAlpha(0);
                break;

    }
  1. 您正在 mapView.addAnnotation 方法上使用 SKAnimationSettings.ANIMATION_NONE,这将禁用放置动画。

  2. SKAnnotationView 不是实时视图。如果不更新注释视图,您将无法编辑或更改它们。