自定义View——画板
今天实现的是画板效果 image 实现原理 image 根据触摸事件返回的坐标点绘制path路径 @Override public boolean onTouchEvent(MotionEvent event) { x = event.getX(); y = event.getY(); switch (event.getAction()) { case MotionEvent.ACTION_DOWN: //当触摸屏幕的时候将点移动到触摸的位置 path.moveTo(x, y); break; case MotionEvent.ACTION_MOVE: //当滑动的时候将滑动路径连接起来 path.lineTo(x, y); //在滑动的过程中不断更新界面 invalidate(); break; case MotionEvent.ACTION_UP: //当手抬起的时候更新界面 invalidate(); break; } return true; } canvas绘制路径 //绘制白色背景 canvas.drawColor(Color.WHITE); //绘制路径 canvas.d...






