I\'m trying to port my app to the brand new Google Maps API v2, but can\'t find how to change the size of the marker (some of my markers are smaller than default).
Best solution I've found is to resize the Bitmap
just before adding it as a Marker
. For example, in my code I use a LevelListDrawable
which references several multiple-resolution Drawable
s. Since I want half-size Markers, I do:
LevelListDrawable d=(LevelListDrawable) getResources().getDrawable(R.drawable.estado_variable);
d.setLevel(1234);
BitmapDrawable bd=(BitmapDrawable) d.getCurrent();
Bitmap b=bd.getBitmap();
Bitmap bhalfsize=Bitmap.createScaledBitmap(b, b.getWidth()/2,b.getHeight()/2, false);
mapa.addMarker(new MarkerOptions()
.position(POSITION)
.title("Title")
.icon(BitmapDescriptorFactory.fromBitmap(bhalfsize))
);
This way, I can keep using Drawables
while been able to obtain differently sized markers just converting them to Bitmap
and resizing as needed.