在EasyConstraintLayout中初始化LayoutParamsData的paths

@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
for (int i = 0, size = getChildCount(); i < size; i++) {
View v = getChildAt(i);
ViewGroup.LayoutParams lp = v.getLayoutParams();
if(lp instanceof EasyLayoutParams){
EasyLayoutParams elp = (EasyLayoutParams) lp;
elp.getData().initPaths(v);
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
在LayoutParamsData中将裁剪阴影的path和裁剪子view的保存起来,新增两个属性

public class LayoutParamsData {
Path widgetPath;
Path clipPath;
boolean needClip;
boolean hasShadow;
public LayoutParamsData(Context context, AttributeSet attrs) {

needClip = radius > 0;
hasShadow = shadowEvaluation > 0;
}
public void initPaths(View v) {
widgetPath = new Path();
clipPath = new Path();
clipPath.addRect(widgetRect, Path.Direction.CCW);
clipPath.addRoundRect(
widgetRect,
radius,
radius,
Path.Direction.CW
);
widgetPath.addRoundRect(
widgetRect,
radius,
radius,
Path.Direction.CW
);
}
}
---------------------

最新文章

  1. SOAPUI使用教程-从现有的服务创建REST模拟服务
  2. 看JVM就推荐这本书
  3. AngularJS入门心得2——何为双向数据绑定
  4. 如何使用vs将现有的项目或者文件夹(尤其是多层目录的)添加到项目中
  5. js求和算法研究
  6. jquery easyui combobox
  7. CIDR
  8. AlertDialog.Builder setCancelable用法
  9. VPN错误789:L2TP连接尝试失败
  10. Object.assign()
  11. Redis学习笔记01--主从数据库配置
  12. Ansible安装部署及常用模块详解
  13. Java技巧之双括弧初始化
  14. NET设计模式 第二部分 结构性模式(14):结构型模式专题总结
  15. Mybatis学习3——动态代理
  16. linux修改hosts
  17. cnn公式推导
  18. Statement执行静态SQL语句
  19. PHP-FPM 与 Nginx 的通信机制总结
  20. 有关padding的二三事~~

热门文章

  1. 浅谈矩阵加速——以时间复杂度为O(log n)的算法实现裴波那契数列第n项及前n之和使用矩阵加速法的优化求法
  2. windows10安装ipython
  3. Java 和操作系统交互,你猜会发生什么?
  4. 使用git版本管理时的免密问题
  5. Vue基于vuex、axios拦截器实现loading效果及axios的安装配置
  6. 使用Kafka的一些简单介绍: 1集群 2原理 3 术语
  7. Mysql8- Public Key Retrieval is not allowed
  8. Cannot change column &#39;id&#39;: used in a foreign key constraint
  9. webpack之给目录起别名
  10. Apache Mesos 官方文档 V1.0