开发者

Android map view auto panning

In my android application i need to do the following :

  1. after fixing the map view to a specific 1st location, the map can't be panned by the user.
  2. the map will be auto panned to different locations and the user tap won't stop its movement.

To be more specific, the application is a kind of a simple game, the user must tap on the right targets to pick it while the map is moving to different location... the targets are some overlays fixed on the map...

One final things, I will be glad to know how to make overlays moving on the map from right to left the back to its primary location and so on.

Edited :

After some googling, I came up to this : First, I need to make the view not reacting for clicks (or tap)

mapView.setClickable(false);
  1. Does that affect the Overlays onTap Methode?

Now, calling the animateTo method with the runnable option like this (mIterator contains a List of GeoPoint )

mapController.animateTo(mIterator.next(), panMap);

The panMap is a Runnable

private Runnable panMap = new Runnable() {

 开发者_C百科   @Override
    public void run() {
        if (mIterator.hasNext()) {
            mapController.animateTo(mIterator.next(), panMap);
        }
}

And there I came to another problem, the animation goes very fast, if there is any way to slow it please tell me.

Any help will be appreciated.


you can have a Thread.sleep() in the loop in run()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜