Android 中的路径测量
PathMeasure in Android
现在我正在学习如何在 android 中使用路径测量。我有 3 条路径:entryPath
、leftPath
和 rightPath
。当我想将这些路径添加到路径测量中时,我尝试了这个:
mTickPath.addPath(entryPath);
mTickPath.addPath(leftPath);
mTickPath.addPath(rightPath);
mTickMeasure = new PathMeasure(mTickPath, false);
// mTickMeasure is a PathMeasure
但是我遇到了一个问题,我的 mTickMeasure.getLenth()
等于 entryPath。mTickPath
与 entryPath
不同 我用过 canvas.drawPath(mTickPath,paint)
并且我得到他们在屏幕上的路径。
PathMeasure.getLength() returns only length of the current contour (in this case, entryPath). PathMeasure.nextContour() 将移动到下一个轮廓,或者 return false 如果它是最后一个。
路径的总长度可以通过添加所有等高线的长度来计算。
现在我正在学习如何在 android 中使用路径测量。我有 3 条路径:entryPath
、leftPath
和 rightPath
。当我想将这些路径添加到路径测量中时,我尝试了这个:
mTickPath.addPath(entryPath);
mTickPath.addPath(leftPath);
mTickPath.addPath(rightPath);
mTickMeasure = new PathMeasure(mTickPath, false);
// mTickMeasure is a PathMeasure
但是我遇到了一个问题,我的 mTickMeasure.getLenth()
等于 entryPath。mTickPath
与 entryPath
不同 我用过 canvas.drawPath(mTickPath,paint)
并且我得到他们在屏幕上的路径。
PathMeasure.getLength() returns only length of the current contour (in this case, entryPath). PathMeasure.nextContour() 将移动到下一个轮廓,或者 return false 如果它是最后一个。
路径的总长度可以通过添加所有等高线的长度来计算。