首页 > 代码库 > android 图片遮罩,水印

android 图片遮罩,水印

动态代码:

Bitmap mark = BitmapFactory.decodeResource(this.getResources(), R.drawable.ic_vip_badger); 
     Bitmap photo = BitmapFactory.decodeResource(this.getResources(), R.drawable.bg_vip_insurance); 
     Bitmap photoMark = Bitmap.createBitmap(photo.getWidth(), photo.getHeight(), Config.ARGB_8888); 
      Canvas canvas = new Canvas(photoMark); 
     canvas.drawBitmap(photo, 0, 0, null); 
     canvas.drawBitmap(mark, photo.getWidth() - mark.getWidth(), 0, null); 
     canvas.save(Canvas.ALL_SAVE_FLAG); 
     canvas.restore(); 
     insurance_vip_imageview.setImageBitmap(photoMark);

使用FrameLayout也可以

android 图片遮罩,水印