贯彻落针动漫谷歌地图上的android [英] Implement falling pin animation on google maps android
本文介绍了贯彻落针动漫谷歌地图上的android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我实现谷歌地图在我的Android应用程序。在这个过程中,我想补充的下降针动画。我已经找遍了人,但无法找到这样做的具体方法。任何一个可以帮助我如何做将是一个很大的帮助......
I am implementing google maps in my android app. In this process I would like to add falling pin animation. I have searched every were but could not find the exact method to do this. Can any one help me out how to do will be a great help...
推荐答案
添加标记所需的位置在地图上,然后调用此函数与标记
Add marker to desired position in map then call this function with that marker
private void dropPinEffect(final Marker marker) {
final Handler handler = new Handler();
final long start = SystemClock.uptimeMillis();
final long duration = 1500;
final Interpolator interpolator = new BounceInterpolator();
handler.post(new Runnable() {
@Override
public void run() {
long elapsed = SystemClock.uptimeMillis() - start;
float t = Math.max(
1 - interpolator.getInterpolation((float) elapsed
/ duration), 0);
marker.setAnchor(0.5f, 1.0f + 14 * t);
if (t > 0.0) {
// Post again 15ms later.
handler.postDelayed(this, 15);
} else {
marker.showInfoWindow();
}
}
});
}
这篇关于贯彻落针动漫谷歌地图上的android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文