2015-04-01 43 views

回答

1

您可以在发光效果(仅)位图上绘制正常的自定义标记位图。

这应该是这个样子:

 int resourceIdCar = R.drawable.car; 
     Bitmap bmpCar = BitmapFactory.decodeResource(getResources(), resourceIdCar); 
     int resourceIdArrow = R.drawable.arrow; 
     Bitmap bmpArrow = BitmapFactory.decodeResource(getResources(), resourceIdArrow); 

     Bitmap bmpOverlay = overlay(bmpCar,bmpArrow); 
     myMarker = googleMap.addMarker(new MarkerOptions() 
         .position(DerekPos) 
         .icon(BitmapDescriptorFactory.fromResource(R.mipmap.ic_launcher)) 
         .title("Hello world") 
         .draggable(true) 
           //.icon(BitmapDescriptorFactory.fromResource(R.drawable.car)) 
         .icon(BitmapDescriptorFactory.fromBitmap(bmpOverlay)) 
     ); 

//=-=-=-=-=-=-= 

private Bitmap overlay(Bitmap bmp1, Bitmap bmp2) { 
    Bitmap bmOverlay = Bitmap.createBitmap(bmp1.getWidth(), bmp1.getHeight(), bmp1.getConfig()); 
    Canvas canvas = new Canvas(bmOverlay); 
    canvas.drawBitmap(bmp1, new Matrix(), null); 
    canvas.drawBitmap(bmp2, new Matrix(), null); 
    return bmOverlay; 
} 

enter image description here

相关问题