Android Bitmap透明背景

直接上源码:


private Bitmap bitmap;

 
  
private Canvas canvas;

bitmap = Bitmap.createBitmap(dmWidth, dmHeight, Bitmap.Config.ARGB_8888);
bitmap.setHasAlpha(true);
 
  
 
  
 
  
canvas = new Canvas(leadsBitmap);
canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
if (canvas == null) {
logger.debug(TAG + "画布为空!"); return;}
 
  
 
  
canvas.drawPoints(mPoints, 0, mPointCount, paint);
 
  
 
  
activity.runOnUiThread(new Runnable() {
    @Override
    public void run() {
        mDrawObject.drawBitmap(mView);
    }
});


public void drawBitmap(ImageView view) {
    view.setBackgroundColor(Color.TRANSPARENT);
    view.setImageBitmap(bitmap);
}

你可能感兴趣的:(Antroid,图形图像(bmp))