如何为具有自定义 View 的 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;
}
最佳答案
您正在
mapView.addAnnotation
方法上使用SKAnimationSettings.ANIMATION_NONE
,这将禁用放置动画。SKAnnotationView
不是实时 View 。如果不更新注释 View ,则无法编辑或更改它们。
关于android - Skobbler Android 无法为自定义 SKAnnotationView 设置动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36539471/