How to make custom view for marker or how to make custom layout. like this... and please look at screenshot:
custom marker for Google Maps using a layout
View markerView = ((LayoutInflater) getActivity()
.getSystemService(
getActivity().LAYOUT_INFLATER_SERVICE))
.inflate(R.layout.map_marker, null);
set marker
marker = map.addMarker(new MarkerOptions()
.position(latLng)
.title(strName)
.snippet(strStatus)
.icon(BitmapDescriptorFactory
.fromBitmap(createDrawableFromView(
getActivity(),
markerView))));
Create Bitmap from Drawable
public static Bitmap createDrawableFromView(Context context, View view) {
DisplayMetrics displayMetrics = new DisplayMetrics();
((Activity) context).getWindowManager().getDefaultDisplay()
.getMetrics(displayMetrics);
view.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));
view.measure(displayMetrics.widthPixels, displayMetrics.heightPixels);
view.layout(0, 0, displayMetrics.widthPixels,
displayMetrics.heightPixels);
view.buildDrawingCache();
Bitmap bitmap = Bitmap.createBitmap(view.getMeasuredWidth(),
view.getMeasuredHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
view.draw(canvas);
return bitmap;
}