2016-03-01 11 views

risposta

47

Attualmente penso che non possiamo cambiare la dimensione marcatore, così u può aggiungere un'immagine marcatore in drawable e ri -size qualcosa di simile :,

int height = 100; 
int width = 100; 
BitmapDrawable bitmapdraw=(BitmapDrawable)getResources().getDrawable(R.mipmap.marker); 
    Bitmap b=bitmapdraw.getBitmap(); 
Bitmap smallMarker = Bitmap.createScaledBitmap(b, width, height, false); 

Ur aggiungere marcatore essere così con l'icona

   map.addMarker(new MarkerOptions() 
         .position(POSITION) 
         .title("Your title") 
         .icon(BitmapDescriptorFactory.fromBitmap(smallMarker)) 
       ); 
+2

Grazie Man !!!!!!! –

0

Penso che si possa cercare una risposta su this question, dove ha già spiegato come creare un marcatore personalizzato, con una larghezza e altezza determinate creando una bitmap dinamica .

0

[edit: formattazione]

Drawable circleDrawable = getResources().getDrawable(R.mipmap.primarysplitter); 
      bitmapDescriptor=getMarkerIconFromDrawable(circleDrawable); 


private BitmapDescriptor getMarkerIconFromDrawable(Drawable drawable) { 
    Canvas canvas = new Canvas(); 
    Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888); 
    canvas.setBitmap(bitmap); 
    drawable.setBounds(0, 0, (int)getResources().getDimension(R.dimen._30sdp), (int)getResources().getDimension(R.dimen._30sdp)); 
    drawable.draw(canvas); 
    return BitmapDescriptorFactory.fromBitmap(bitmap); 
} 
Problemi correlati