@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
mLayer = new RectF(0, 0, w, h);
RectF areas = new RectF();
areas.left = getPaddingLeft();
areas.top = getPaddingTop();
areas.right = w - getPaddingRight();
areas.bottom = h - getPaddingBottom();
mClipPath.reset();
if (mRoundAsCircle) {
float d = areas.width() >= areas.height() ? areas.height() : areas.width();
float r = d / 2;
PointF center = new PointF(w / 2, h / 2);
mClipPath.addCircle(center.x, center.y, r, Path.Direction.CW);
mClipPath.moveTo(-mEdgeFix, -mEdgeFix); // 通过空操作让Path区域占满画布
mClipPath.moveTo(w + mEdgeFix, h + mEdgeFix);
} else {
mClipPath.addRoundRect(areas, radii, Path.Direction.CW);
}
Region clip = new Region((int) areas.left, (int) areas.top,
(int) areas.right, (int) areas.bottom);
mAreaRegion.setPath(mClipPath, clip);
}
RCRelativeLayout.java 文件源码
java
阅读 36
收藏 0
点赞 0
评论 0
项目:rclayout
作者:
评论列表
文章目录