Android Simple Draw
Why it doesn't work ? I'm trying to 'paint' where i put my finger, to write something. For example, when i am trying to make a C he looks like this: http://postimg.org/image/5obyi
Solution 1:
EDIT: this reflects changes you made in your code.
When you create mPaint, you're not setting its' style, which by default is FILL. Change it to STROKE. You can also set the stroke width. Do it in your constructor:
public BlackPixel(Context context) {
super(context);
setFocusable(true);
setFocusableInTouchMode(true);
this.setOnTouchListener(this);
//change paint style to STROKE
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeWidth(12);
}
Also, you can set the background color in onSizeChanged:
@OverrideprotectedvoidonSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
mBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
//set background color
mBitmap.eraseColor(0xFFAAAAAA);
mCanvas = newCanvas(mBitmap);
}
Check FingerSample in Android SDK samples folder.
Post a Comment for "Android Simple Draw"