android实现箭头流程列表_如何使用Android图形类绘制箭头?

bd96500e110b49cbb3cd949968f18be7.png

How can i draw an arrow using the graphics class?

Im using android graphics class and basically im trying to show a path on a map. So i need to print an arrow head on the canvas. Help me to figure out!

Thank you!

This is one of the methods i have used to draw a line. i want to print an arrow head on the edge of each and every line.

// ArrayList ArrayListPoints = new ArrayList(); // Assign the shortest path here

// ArrayListPoints.add(new Point(262,100));

// ArrayListPoints.add(new Point(262,165));

// ArrayListPoints.add(new Point(346,165));

// ArrayListPoints.add(new Point(420,165));

ArrayList ArrayListPointsFINAL;

ArrayListPointsFINAL = storePath.ArrayListPoints;

if(ArrayListPointsFINAL == null){

System.out.println("ArrayListPointsFINAL is NULL");

}

else{

ArrayList ArrayList_X = new ArrayList();

ArrayList ArrayList_Y = new ArrayList();

//int size = get.ArrayListPoints.size();

for(int i=0; i

ArrayList_X.add(Float.parseFloat(String.valueOf(ArrayListPointsFINAL.get(i).x)));

ArrayList_Y.add(Float.parseFloat(String.valueOf(ArrayListPointsFINAL.get(i).y)));

}

for(int i=1; i

Paint myPaint = new Paint(Paint.ANTI_ALIAS_FLAG);

myPaint.setStrokeWidth(8/*1 /getResources().getDisplayMetrics().density*/);

myPaint.setColor(0xffff0000); //color.RED

// myPaint.setStyle(myPaint);

canvas.drawLine(ArrayList_X.get(i), ArrayList_Y.get(i), ArrayList_X.get(i-1), ArrayList_Y.get(i-1),myPaint);

}

解决方案

You can draw a Bitmap instead and apply a matrix to it.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值