为孩子们创建一个应用程序是一项艰巨的任务,我的任务是创建一个连接点的应用程序。
例子
https://play.google.com/store/apps/details?id=zok.android.dots https://play.google.com/store/apps/details?id=zok.android.dots
我已经做了一些 onTouchEvent 的教程。
我知道如何在屏幕上绘画用手指在 Canvas 中绘图,Android https://stackoverflow.com/questions/16650419/draw-in-canvas-by-finger-android
我正在使用这个获取点坐标Android:如何获取图像/ImageView 中的 x y 坐标? https://stackoverflow.com/questions/8909835/android-how-do-i-get-the-x-y-coordinates-within-an-image-imageview例子
但我真的不知道如何实现这个目标。
我真的很感激这个问题的解决方案!谢谢!
输入图像是https://i.stack.imgur.com/vlmcp.png https://i.stack.imgur.com/vlmcp.png
EDIT
@Override
protected void onDraw(Canvas canvas) {
//backgroundBitmap is the image i want to show in background
if(DISPLAY_ALPHABET==0)
{
canvas.drawBitmap(backgroundBitmap, 0f, 0f, null);
DISPLAY_ALPHABET=1;
}
show(canvas);
}
public void show(Canvas canvas)
{
Paint paint = new Paint();
int cnt=1;
canvas.drawPaint(paint);
//color of numbers
paint.setColor(Color.BLUE);
paint.setTextSize(16);
canvas.drawColor(BACKGROUND);
** canvas.drawBitmap(mBitmap, 0, 0, null);**
canvas.drawPath(mPath, mPaint);
mPaint.setColor(Color.BLACK);
//Drawing points on canvas
for (Point point : mPoints) {
canvas.drawPoint(point.x, point.y, mPaint);
canvas.drawText(""+cnt++, point.x-7, point.y-7, paint);
}
mPaint.setColor(Color.RED);
}