Android - Paint Simple - Tạo View vẽ hình đơn giản trên Android Studio
Tạo một lớp SimplePaintView public class SimplePaintView extends View { public int width ; public int height ; private Bitmap mBitmap ; private Canvas mCanvas ; private Path mPath ; private Paint mBitmapPaint ; Context context ; private Paint circlePaint ; private Path circlePath ; private Paint pencil ; public SimplePaintView (Context c , int lineColor) { super (c) ; getPencil(lineColor) ; context = c ; mPath = new Path() ; mBitmapPaint = new Paint(Paint. DITHER_FLAG ) ; circlePaint = new Paint() ; circlePath = new Path() ; circlePaint .setAntiAlias( true ) ; circlePaint .setColor(getResources().getColor(R.color. colorPrimary )) ; circlePaint .setStyle(Paint.Style. STROKE ) ; circlePaint .setStrokeJoin(Paint.Join. MITER ) ; circlePaint .setStrokeWidth( 4f ) ; } private void getPencil ( int lineColor) { penci