【问题标题】:PathMeasure in AndroidAndroid 中的路径测量
【发布时间】:2016-12-02 08:37:20
【问题描述】:

现在我正在学习如何在 android 中使用 pathmeasure。我有 3 条路径:entryPathleftPathrightPath。当我想将这些路径添加到路径测量中时,我试过这个:

    mTickPath.addPath(entryPath);
    mTickPath.addPath(leftPath);
    mTickPath.addPath(rightPath);
    mTickMeasure = new PathMeasure(mTickPath, false);
    // mTickMeasure is a PathMeasure

但是我遇到了一个问题,我的 mTickMeasure.getLenth() 等于 entryPath。mTickPathentryPath 不同,我使用了 canvas.drawPath(mTickPath,paint) 并且我在屏幕上显示了它们的路径。

【问题讨论】:

    标签: android path measure


    【解决方案1】:

    PathMeasure.getLength() 仅返回当前轮廓的长度(在本例中为 entryPath)。 PathMeasure.nextContour() 将移动到下一个轮廓,如果是最后一个则返回 false。

    路径的总长度可以通过添加所有轮廓的长度来计算。

    【讨论】:

      猜你喜欢
      • 2013-05-11
      • 2020-08-24
      • 1970-01-01
      • 2022-01-06
      • 2012-12-13
      • 1970-01-01
      • 2017-06-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多