How do I drop spots on Google Map in an Android app?
I'm developing an Android application where I want to pin out certain spots/addresse开发者_运维问答s on a google map. I have managed to add point to a mapView using OverlayItem and a Drawable. That works great.
But I have installed an application where the pins/spots are added asynchronously, and it looks like they are dropped from the top of the screen on to the map. Looks really nice.
I think I can manage to code the async functionality using threads, but I have no idea how to implement the "falling" feature... Does anyone have a clue??
That would seem difficult, unless the map were stationary.
If the map won't be panning/zooming, you could do the "falling" via a TranslateAnimation
, applied to an ImageView
that floats above the map (e.g., later child in the RelativeLayout
that holds the MapView
). When the animation completes, you'd make the ImageView
be View.GONE
, and you'd add the actual marker to the ItemizedOverlay
.
Here is a sample project showing how to do drag-and-drop of an OverlayItem
using a similar core concept.
精彩评论