SuperAPI AI 工具集

android-viewsystem-foundations

前端与建站

查看项目

更新于 10-16 06:22

技能介绍

用途:当请求涉及 XML 布局问题、Fragment 生命周期或 ConstraintLayout 清理时使用。主要处理 XML 布局、ConstraintLayout、Fragment、ViewBinding、DataBinding 与经典 Android UI 生命周期模式,适用面是 XML、Fragment、RecyclerView 或绑定生命周期工作,而非 Compose 优先 UI。

主要能力与工作流程:先判断目标界面是 Fragment、Activity、自定义 View、RecyclerView 还是混合 Compose/View 互操作界面;正确锚定所有权,视图绑定归属视图生命周期,适配器绑定显式条目模型,导航与事务放在叶子视图之外;优先用经典 View 工具修复布局与渲染问题,包括 ConstraintLayout、RecyclerView diffing、窗口 insets 与安全的绑定更新;在认为改动完成前,验证 Fragment 重建、长文本、字体缩放、RTL 与进程生命周期边界情况。

限制与原则:优先稳定状态与可预测渲染,再考虑动画或抽象;默认尊重无障碍语义、对比度、焦点顺序与触摸目标规范;没有明确互操作边界时不要混用 Compose 与 View 系统所有权;优先经过度量的性能工作而非过早微优化;Fragment 视图销毁时清理 ViewBinding 引用,不将视图引用保留到视图生命周期之后。避免在叶子 UI 组件中嵌入导航或业务逻辑、使用在本地化或动态文本下失效的固定尺寸、只宣告视觉变化而忽略语义、把 XML 模式直接移植到 Compose、在视图重建后保留失效绑定或适配器中的 Fragment 视图状态。

示例命令:cd examples/orbittasks-xml && ./gradlew :app:testDebugUnitTest;cd examples/orbittasks-xml && ./gradlew :app:connectedDebugAndroidTest;python3 scripts/eval_triggers.py --skill android-viewsystem-foundations。范围扩大时可交接给 android-compose-xml-interoperability、android-testing-ui。官方参考见 https://developer.android.com/guide/fragments、https://developer.android.com/topic/libraries/view-binding、https://developer.android.com/training/constraint-layout、https://developer.android.com/topic/libraries/data-binding。