Google android maps api v2 Show Marker Title Always

后端 未结 6 1666
南旧
南旧 2020-12-14 14:47

I have a google maps v2 in my android application and some markers on it. When user click one of these markers, a title popup comes. How can I show these ti

6条回答
  •  攒了一身酷
    2020-12-14 15:15

    Maybe I am a bit late in answering this one but the code below works for me:

    //add this library

    implementation 'com.google.maps.android:android-maps-utils:0.5'
    

    //then use the method below

    public void makersMaker(GoogleMap googleMap){
        IconGenerator iconFactory = new IconGenerator(this);                            
        Marker marker1 = googleMap.addMarker(new MarkerOptions().position(newLatLng(-1.3177336,36.8251902));                  
        marker1.setIcon(BitmapDescriptorFactory.fromBitmap(iconFactory.makeIcon("Marker 1")));
        Marker marker2 = googleMap.addMarker(new MarkerOptions().position(new LatLng(-1.2857399,36.8214088)));                
        marker2.setIcon(BitmapDescriptorFactory.fromBitmap(iconFactory.makeIcon("Marker 2")));
    }
    

提交回复
热议问题