I\'ve been trying to add a shape drawable as the marker icon for a marker I want to add on the map.
shape looks like this (res/drawable/blue_circle.xml):
<
Here's an answer if you're using the com.google.maps.android:android-maps-utils library.
Create a Bitmap using IconGenerator
IconGenerator iconGen = new IconGenerator(context);
// Define the size you want from dimensions file
int shapeSize = getResources().getDimensionPixelSize(R.dimen.shape_size);
Drawable shapeDrawable = ResourcesCompat.getDrawable(getResources(), R.drawable.my_shape, null);
iconGen.setBackground(shapeDrawable);
// Create a view container to set the size
View view = new View(context);
view.setLayoutParams(new ViewGroup.LayoutParams(shapeSize, shapeSize));
iconGen.setContentView(view);
// Create the bitmap
Bitmap bitmap = iconGen.makeIcon();
Then use the bitmap like you would when setting the marker icon BitmapDescriptorFactory.fromBitmap(bitmap)