在需要圆角矩形纯色背景、描边边框时,优先用 DevWidget(io.github.afkt:DevWidgetX)的 dev.widget.ui.round 包替代 shape / layer-list drawable。流程与核心坑在 SKILL,Round 系列 View、R.styleable.DevWidget 中 app:dev_* 属性及源码对照见 references/reference.md。工作区内优先 Read lib/DevWidget;仅当无该模块时再查上游 GitHub。
80
100%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
round 包:圆角 + 纯色 + 描边本 Skill 内凡涉及 DevWidget 源码与资源,先读工作区本地模块;勿在本地存在时 WebFetch GitHub 替代。
| 符号 | 当前值(DevUtils) | 说明 |
|---|---|---|
DEVWIDGET_ROOT | lib/DevWidget | DevWidget 模块根目录 |
完整路径、属性表与 Round 类型清单见 references/reference.md。工作区无 {DEVWIDGET_ROOT} 或需对照远程 tag 时,才使用上游 fallback:https://github.com/afkT/DevUtils/tree/master/lib/DevWidget
shape.xml / layer-list / selector drawable。{DEVWIDGET_ROOT}/README.md。dev.widget.ui.round 下的实现;不引导使用 dev.widget.ui.radius 等其他目录。app:dev_*,少建 drawable 文件。android:background 混用(RoundDrawable 方案):圆角背景占用了 View 的 background。在 XML 里写 android:background 不会按预期生效;背景色、边框请用下文 app:dev_backgroundColor、app:dev_borderWidth、app:dev_borderColor。ColorStateList),不支持 Bitmap/复杂 Drawable 作背景。xmlns:app="http://schemas.android.com/apk/res-auto"(以工程为准)。常用:RoundFrameLayout、RoundLinearLayout、RoundConstraintLayout、RoundTextView、RoundButton、RoundImageView、RoundDrawable。完整类列表与用途见 references/reference.md § Round 包类型一览。
选控件:与原生同名布局一致即可(要 Constraint 用 RoundConstraintLayout,要文字用 RoundTextView…)。
RoundImageView 与其它 Round 的差异*:仅负责圆形头像式展示(CENTER_CROP);若要圆角矩形图片请不在本 Skill 范围内另选方案。
属性定义以 {DEVWIDGET_ROOT}/src/main/res/values/attrs.xml 为准;所有属性在资源中声明为 DevWidget 分组,XML 前缀一般为 app:。全表见 references/reference.md § XML 属性。
圆角逻辑摘要(对照 reference 中 RoundDrawable.java):
dev_radiusLeftTop / RightTop / LeftBottom / RightBottom > 0:使用 setCornerRadii 四角独立圆角,并 关闭 radius adjust bounds 的自动行为。dev_radius 作为 setCornerRadius;若 dev_radius > 0 同样会关闭与「仅 adjust」相关的自动圆角逻辑。setStrokeData(borderWidth, borderColor)。注意:RoundImageView 的专用属性与限制见 references/reference.md § 仅 RoundImageView;它固定为圆形裁剪,不用于圆角矩形图片。
RoundDrawable.fromAttributeSet、setBackgroundKeepingPadding 与链式 API 见 references/reference.md §代码侧 API。
<dev.widget.ui.round.RoundTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="12dp"
android:paddingVertical="6dp"
android:text="标签"
app:dev_backgroundColor="#33FF5722"
app:dev_borderColor="#FFFF5722"
app:dev_borderWidth="1dp"
app:dev_radius="8dp" />胶囊 View:将 app:dev_isRadiusAdjustBounds 设为 true,并通常配合高度与 dev_backgroundColor / 描边使用(具体圆角值由短边一半决定)。
{DEVWIDGET_ROOT}(存在时未用 WebFetch 代替)?android:background 覆盖圆角背景?Round*Layout / RoundTextView 之一?RoundImageView 且接受 CENTER_CROP?app:dev_borderWidth + app:dev_borderColor 组合?3fa9400
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.