开发者

Android MapView Overlay that does always keeps an OverlayItem selected?

I want to add an ItemizedOverlay to a开发者_如何转开发 MapView that always keeps one OverlayItem as the selected one. I indicate this by using a StateListDrawable with two different marker drawables.

But right now, whenever I tap on the map and not hitting a marker, the last selected item will get deselected. But I always want to keep the last item selected until a new one is hit.

I already tried to intercept e.g. onTap, but this only lets me completely disable the tap handling. This means now I can't even select another marker anymore.

Any suggestions what to do about this?


I got an answer on the android developer ml. I think this would the correct solution, if the mapview wouldn't have a bug in itself.

http://code.google.com/p/android/issues/detail?id=6752

Here the proposed solution:

Keep track of the last selected item. In onTap() if the currentFocus() is null, setFocus() to the last selected item you saved. If it's not null, update your reference.

You can also use the same idea but using the OnFocusChangeListener on the ItemizedOverlay to determine if a new item has been focuses or not.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜