1

在我的应用程序中,我需要在ImageViewusing上显示一组点之间的导航路径Canvas。我可以在 an 上绘制路径,ImageView但我需要绘制类似于此图像:

导航路径图片

是否可以使用Canvason绘制这样的导航路径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));
4

0 回答 0