Android examples for Graphics:Canvas
erase Rectangle from Canvas
//package com.java2s; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.PorterDuffXfermode; import android.graphics.RectF; public class Main { public static void erase(Canvas canvas, RectF rectf) { Paint paint = new Paint(); paint.setColor(0);/*from w w w . j a va 2s . c o m*/ paint.setDither(true); paint.setXfermode(new PorterDuffXfermode( android.graphics.PorterDuff.Mode.CLEAR)); canvas.drawRect(rectf, paint); } }