views:

70

answers:

1

Trying to solve my current problem of drawing an image on an Android MapView and then animate it to represent a moving object, I decided to try to just draw a raw ImageView at a GeoPoint on the map and then try and animate it from there.

This is the code I put in my map activity (extends MapActivity)'s onCreate method:

GeoPoint point = new GeoPoint(19240000, -99120000);
ImageView iv = new ImageView(this);
iv.setImageResource(R.drawable.icon);
LayoutParams lp = new LayoutParams(iv.getWidth(), iv.getHeight(), point, LayoutParams.BOTTOM);

mapView.addView(iv, lp);

Again, I'm just trying to draw the static icon and animate it from there. I can already do this with an ItemizedOverlay, but as far as I can tell, I can't animate the elements of an AnimatedOverlay the way that I can animate a view. Thus, using ImageView.

But the icon doesn't show up. Any thoughts or suggestions?

+1  A: 
MapView.LayoutParams screenLP = new MapView.LayoutParams(MapView.LayoutParams.WRAP_CONTENT, 
                MapView.LayoutParams.WRAP_CONTENT, point, width/2,
                0, MapView.LayoutParams.LEFT | MapView.LayoutParams.BOTTOM)

Have you tried with the WRAP_CONTENT tags?

I82Much
I don't get it but it works. I've got a little pin on my map. Thanks a lot!
Hober