1

i'm trying to show text for all markers. I've seen this solution: http://googlemaps.github.io/android-maps-utils/ And checked the http://googlemaps.github.io/android-maps-utils/javadoc/

I've succeeded to get to this situation: prob

But as you can see the text is on the icon, and I want it to have a bit of margin button - and I can't figure out how to do it.

This is the code I used to make the marker:

 Context context = getApplicationContext();
                TextView text = new TextView(context);
                text.setText(pilotName);
                text.setTextSize(18);
                text.setTypeface(null, Typeface.BOLD);
                text.setTextColor(getResources().getColor(R.color.colorBlack));
                IconGenerator generator = new IconGenerator(context);
                generator.setContentPadding(20,20,0,0);
                generator.setBackground(context.getDrawable(R.drawable.aircraft));
                generator.setContentView(text);
                Bitmap icon = generator.makeIcon();
                MarkerOptions tp = new MarkerOptions().position(latLng).icon(BitmapDescriptorFactory.fromBitmap(icon));
                mMap.addMarker(tp);

I've also tried: text.setPadding(40, 40, 0, 0); And generator.setContentPadding(20,20,0,0); to see if it solves it... and it didn't work

How can I solve it? Thanks

jonb
  • 845
  • 1
  • 13
  • 36
  • 1
    You'll need to use a layout and then render a drawable from that layout. See https://stackoverflow.com/questions/48947084/how-to-show-all-marker-labels-in-google-maps-simultaenously/48949960#48949960. Once you have that set up then you can customize the layout to your satisfaction. –  Mar 11 '18 at 01:49
  • I'll check it out soon and update if it worked. Thanks – jonb Mar 11 '18 at 14:43

0 Answers0