Android 数组路径 - 读取路径上的点? [英] Android path to array - read the points on a path?

查看:24
本文介绍了Android 数组路径 - 读取路径上的点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法读取绘制路径时创建的点?路径不可读对我来说似乎很愚蠢.

Is there a way to read the points created when drawing a path? It seems silly to me that a path cannot be readable.

还是手动将当前手指位置写入数组更好?

Or is it just better to manually write the current finger position to an array?

谢谢

推荐答案

您可以从任何路径读取任意数量的点.示例如何从路径中间读取坐标:

You can read as many points as you want from any path. Example how to read coordinates from the middle of path:

    PathMeasure pm = new PathMeasure(myPath, false);
    //coordinates will be here
    float aCoordinates[] = {0f, 0f};

    //get coordinates of the middle point
    pm.getPosTan(pm.getLength() * 0.5f, aCoordinates, null);

您可以通过从路径开始的任意距离来获取点坐标.

You can pass any distance from the path start to get point coordinates.

这篇关于Android 数组路径 - 读取路径上的点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆