maoruibin / maoruibin/maoruibin.github.com
绘制只有两个圆角的圆角矩形
Open
Nobody has claimed this yet.
trick
View
- Dominant language
- HTML
- Stars
- 22
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
canvas.save();
mChartPaint.setColor(color);
canvas.clipRect(rect.left, rect.top, rect.right, rect.bottom - roundRadius, Region.Op.INTERSECT);
canvas.drawRoundRect(rect, roundRadius, roundRadius, mChartPaint);
canvas.restore();
一般的 drawRoundRect 方法画出的圆角矩形为四个圆角,但是一些情况下,设计师设计出的 UI 可能只有顶部两个圆角,如下所示

这时,可以使用 clipRect 进行裁剪,巧妙做到绘制区域的裁剪
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No repository file, test, or entry point is named. First determine whether this issue is intended to add or revise a blog post, using the supplied Java Canvas example and two-corner design image as the content reference. Done should be a published, accurate explanation after the maintainers confirm the scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100