参考:https://mp.weixin.qq.com/s/hiWxzJkDjvDoClOUuJI7CA
其实最关键的地方是在dispatchTouchEvent中调用了
isTransformedTouchPointInView()判断的
protected boolean isTransformedTouchPointInView(float x, float y, View child,
PointF outLocalPoint) {
final float[] point = getTempPoint();
point[0] = x;
point[1] = y;
transformPointToViewLocal(point, child);
final boolean isInView = child.pointInView(point[0], point[1]);
if (isInView && outLocalPoint != null) {
outLocalPoint.set(point[0], point[1]);
}
return isInView;
}
/**
* @hide
*/
public void transformPointToViewLocal(float[] point, View child) {
point[0] += mScrollX - child.mLeft;
point[1] += mScrollY - child.mTop;
if (!child.hasIdentityMatrix()) {
child.getInverseMatrix().mapPoints(point);
}
}
最终的结果就是判断child.hasIdentityMatrix()的返回值
验证:
view既没有做view动画也没有做属性动画 结果 view做了属性动画 结果 做了view动画
结果
网友评论