Android 图片遮罩,水印代码

jopen 10年前

动态代码:

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也可以