美文网首页
常用方法:View

常用方法:View

作者: 别却江南 | 来源:发表于2019-06-18 10:33 被阅读0次
  • 判断目标点是否在view范围内
fun View.pointInView(points: FloatArray): Boolean {
    points[0] = points[0] - this.left
    points[1] = points[1] - this.top
    val matrix = this.matrix
    if (!matrix.isIdentity) {
        matrix.invert(matrix)
        matrix.mapPoints(points)
    }
    return points[0] >= 0 && points[1] >= 0 && points[0] < this.width && points[1] < this.height
}

相关文章

网友评论

      本文标题:常用方法:View

      本文链接:https://www.haomeiwen.com/subject/vjpxqctx.html