简体   繁体   中英

Marker multiple snippet Google Maps API 2

I'm trying to create a marker with multiple lines on my snippet, the thing that I've tried is :

  Marker mjdd1 = mMap.addMarker(new MarkerOptions()
           .position(JDD1)
           .title(s)
           .snippet("C/ Palim, 2-5-Ctra.N-II \n"+ "08330 sads de Mar \n" + "Lunes - Sábado \n" + "09:15 - 21:15 "
                   )

           .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_launcher_mapa)));

But it shwos all in one line, the other thing that i've tried is put the title with other color doing :

String s="Clows" ;
    SpannableString ss=  new SpannableString(s);
    ss.setSpan(new ForegroundColorSpan(Color.BLUE), 0, 5, 0);

But it shows black...

Thanks.

I think you should try to use Custom info windows for Google Maps Android API v2

To do this, you must create a concrete implementation of the InfoWindowAdapter interface and then call GoogleMap.setInfoWindowAdapter() with your implementation.

The interface contains two methods for you to implement: getInfoWindow(Marker) and getInfoContents(Marker) . The API will first call getInfoWindow(Marker) and if null is returned, it will then call getInfoContents(Marker) . If this also returns null, then the default info window will be used.

For more details, please refer to here , and here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM