2011-04-23 118 views
0

如何刪除Android中可繪製圖像的黑色陰影? enter image description here如何刪除Android中Drawable圖像中的黑色陰影?

 Drawable d = new BitmapDrawable(bitmap);mapController.animateTo(geoPoint); 

     mapOverlay = new MapOverlay(d); 
     listOfOverlays = mapView.getOverlays(); 
// listOfOverlays.clear(); 
     listOfOverlays.add(mapOverlay); 

     overlayitem = new OverlayItem(geoPoint, "", "");  
     mapOverlay.addOverlay(overlayitem);  
     listOfOverlays.add(mapOverlay); 

     mapView.invalidate(); 
+0

你可以發佈你用來顯示Drawable的代碼嗎? – shihpeng 2011-04-23 11:15:48

回答

0

你必須繼承的Overlay類並覆蓋draw()方法。像這樣:

public class MyOverlay extends Overlay 
{ 
    ..... 
    // obtain the BitMap of the image you want to draw on map 
    ..... 

    @Override 
    public void draw(Canvas canvas, MapView mapView, boolean shadow) 
    { 
     ..... 
     // draw the BitMap on the canvas   
     ..... 

     super.draw(canvas, mapView, false); 
    } 
} 

影子是使用OverlayItem的默認行爲。