Android的图形页面MapController stopAnimation没有停止动画 [英] Android MapView MapController stopAnimation not stopping animation

查看:148
本文介绍了Android的图形页面MapController stopAnimation没有停止动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很好,我正在开发Android版中的一个地理位置的应用程序。在第一次运行时,我们集中在当前位置地图,那么用户可以缩放和平移自由自在,但我们有一个按钮,动画地图和中心回的实际位置。

well, i'm developing a geolocation app in Android. On first run we center the map at the current location, then the user can zoom and pan freedomly, but we have a button that animates the map and centers it back to the actual position.

问题是,这只是发生在地图是静态的:如果用户滚动地图并使其惯性滚动,直到动画停止此按钮将无法正常工作

The problem is that this just happens when the map is static: if the user scrolls the map and leaves it scrolling by inertia, this button won't work until the animation is stopped.

这里的code。

mapView.getController().stopAnimation(false); //this aint working as expected
mapView.getController().animateTo(myLocationOverlay.getMyLocation());

感谢。

推荐答案

这对我的作品:

public void centerCurrentClickHandler(View v) {
    if (hasCurrentPosition) {
        GeoPoint point = new GeoPoint(currentLatitudeE6, currentLongitudeE6);
        mapController.animateTo(point);
    }
}

public void centerFlagClickHandler(View v) {
    if (hasPushpinPosition) {
        GeoPoint point = new GeoPoint(pushpinLatitudeE6, pushpinLongitudeE6);
        mapController.animateTo(point);
    }
}

这篇关于Android的图形页面MapController stopAnimation没有停止动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆