在android开发中,我们有时会采用如下api来生成一个Path对象:

Path path = new Path();path.addPath(firstPath);path.addPath(secondPath);

后期我们想将该path拆分为多个path,可以采用如下方法:

ArrayList<Path> list = new ArrayList<Path>();PathMeasure pm = new PathMeasure(path, true);float segment = 0;Path tempPath;do {    tempPath = new Path();    tempPath.rewind();    pm.getSegment(segment, segment + pm.getLength(), tempPath, true);    segment += pm.getLength();    tempPath.close();    list.add(tempPath);} while (pm.nextContour());

上述代码返回的list即为我们之前添加到path中的各个Path对象的集合。

更多相关文章

  1. 没有一行代码,「2020 新冠肺炎记忆」这个项目却登上了 GitHub 中
  2. android activity-alias 的作用
  3. android的Dialog使用
  4. day4.12总结_view Animation和Property Animation
  5. android中的保存数据方法
  6. Android(安卓)studio的安装、环境配置和使用方法
  7. Android(安卓)adb.exe程序启动不起来处理方法
  8. Android(安卓)Studio 自动代码提示设置
  9. android 混淆代码

随机推荐

  1. Android沉浸式状态栏
  2. Android的四种基本布局
  3. 由Android(安卓)65K方法数限制引发的思考
  4. Android studio 打不开官方虚拟机 100%成
  5. Android中 ScrollView(ListView)中嵌套List
  6. Android之toolbar的使用
  7. Android线程池
  8. Android学习-RecyclerView默认scrollbar
  9. 输入法软键盘搜索执行两次的解决方法
  10. Android(安卓)系统入门