在我的应用程序中,我需要在ImageView
using上显示一组点之间的导航路径Canvas
。我可以在 an 上绘制路径,ImageView
但我需要绘制类似于此图像:
是否可以使用Canvas
on绘制这样的导航路径ImageView
?
请指导我这个概念。
这是我的代码:
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.nipun_floor_temp);
imageView.setImageBitmap(bitmap);
Bitmap drawBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.RGB_565);
Canvas canvas = new Canvas(drawBitmap);
canvas.drawBitmap(bitmap, 0, 0, null);
// Line
Paint paint = new Paint();
paint.setColor(Color.BLUE);
paint.setStrokeWidth(15);
int startx = 340;
int starty = 103;
int endx = 340;
int endy = 503;
canvas.drawLine(startx, starty, endx, endy, paint);
imageView.setImageDrawable(new BitmapDrawable(getResources(), drawBitmap));