首先布局要用帧布局

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
   >
      <ImageView
       android:id="@+id/after"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:src="@drawable/b0"
          /> 
       <ImageView
       android:id="@+id/befor"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       />
</FrameLayout>


MainActivity:

public class MainActivity extends Activity {
                                                            
    private ImageView preImageView,aftImageView;
    private Canvas canvas;
    private Paint paint;
    private Bitmap alterbitmap;
                                                             
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        /*BitmapFactory.Options options =new Options();
        options.inSampleSize=2;*/     
        preImageView=(ImageView) findViewById(R.id.befor);
        aftImageView=(ImageView) findViewById(R.id.after);
                                                                 
        Bitmap befor=BitmapFactory.decodeResource(getResources(), R.drawable.a0);//只读的
        Bitmap after=BitmapFactory.decodeResource(getResources(), R.drawable.b0);
        //可修改的Bitmap
        alterbitmap=Bitmap.createBitmap(befor.getWidth(), befor.getHeight(), befor.getConfig());
        canvas=new Canvas(alterbitmap);
        paint=new Paint();
        paint.setStrokeWidth(5);//设置画笔的宽度
        paint.setColor(Color.BLACK);
        canvas.drawBitmap(befor, new Matrix(), paint);
                                                                 
        //设置图片
        preImageView.setImageBitmap(alterbitmap);
        aftImageView.setImageBitmap(after);
                                                                 
        preImageView.setOnTouchListener(new OnTouchListener() {
                                                                     
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                                                                         
                switch (event.getAction()) {
                case MotionEvent.ACTION_MOVE:
                    int newx=(int) event.getX();
                    int newy=(int) event.getY();
                    //将触摸点上下8个像素的位置设为透明
                    for (int i = -8; i <8; i++) {
                        for (int j =-8; j < 8; j++) {
                            alterbitmap.setPixel(newx+i, newy+j, Color.TRANSPARENT);
                        }
                    }
                    preImageView.setImageBitmap(alterbitmap);
                    break;
                }             
                return true;
            }
        });
    }
}

运行结果都懂的,再次不在给出。呵呵(源码太大,可到下载区下载

注:当手指点击位置-8超出屏幕位置时会报一个异常,读者可以自行解决。另外该程序在4.0版本手机运行正常,在2.3版本手机上运行擦除后背景一片漆黑(待解决)