Max Alexander
Max Alexander

Reputation: 5581

Skobbler Android Cannot Animate custom SKAnnotationView

How can I animate an SKAnnotationView that has a Custom View. I've inflated it properly and it shows up correctly like :

    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);

On click, I'd like to make it invisible. I get the appropriate RelativeLayout and it's the correct instance however, it won't mutate the animation state. Why is the instance correct and not null but the animation alpha change not carried out?

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

    }

Upvotes: 1

Views: 89

Answers (1)

farhanahmed95
farhanahmed95

Reputation: 26

  1. You are using SKAnimationSettings.ANIMATION_NONE on mapView.addAnnotation method which will disable drop animations.

  2. SKAnnotationView are not live views. You cannot edit or change them without updating annotation view.

Upvotes: 1

Related Questions