初始化: final Animation animationVoice = AnimationUtils.loadAnimation(this,R.anim.voice_button_anim);voice_back.startAnimation(animationVoice);
资源文件:anim文件:
动态计算地图坐标进行转换位置变化:
mSceneView.addViewpointChangedListener(new ViewpointChangedListener() {
@Override
public void viewpointChanged(ViewpointChangedEvent viewpointChangedEvent) {
for (int i = 0; i < viewpointChangedEvent.getSource().getGraphicsOverlays().size(); i++) {
if (viewpointChangedEvent.getSource().getGraphicsOverlays().get(i) == mGraphicsOverlay) {
voice_back.setVisibility(View.VISIBLE);
LocationToScreenResult point = mSceneView.locationToScreen((Point) viewpointChangedEvent.getSource().getGraphicsOverlays().get(i).getGraphics().get(0).getGeometry());
voice_back.setAnimation(animationVoice);
WidgetController.setLayout(voice_back, point.getScreenPoint().x, point.getScreenPoint().y);
voice_back.setAnimation(animationVoice);
Log.e("hsjdahdapoint", point.getScreenPoint().x + "");
}
}
}
});
复制代码
WidgetController.setLayout(voice_back, point.getScreenPoint().x, point.getScreenPoint().y);