Our designer has provided me with a custom icon to display on maps. Our MapView will display several icons of those at the same time.
The tricky part: every icon should have a text above it displaying what it is - and all icons should show this text always simultaneously.
So I know that there is .showInfoWindow(), but that only shows one window at a time and only onclick.
I found this SO post: Map Markers with text in Google Maps Android API v2
but that's using google's library and it only is able to use a colored rectangle as a text holder, not, as in my case, an icon AND the text above.
Searching, I found several ideas but none seems to work. My last attempt:
LatLng pos = new LatLng(lat, lng);
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.icon).copy(Bitmap.Config.ARGB_8888, true);
Canvas canvas = new Canvas(bm);
Paint paint = new Paint();
paint.setStyle(Paint.Style.FILL);
paint.setColor(Color.WHITE);
paint.setTextAlign(Paint.Align.CENTER);
paint.setTextSize(11));
canvas.drawText(item.getString("name"), 10, -20, paint);
Marker marker = mMap.addMarker(new MarkerOptions()
.position(pos)
.title(item.getString("name"))
.icon(
BitmapDescriptorFactory.fromBitmap(bm)
)
);
But I still can only see the icon and no text.