android - 子模块自定义属性 AndroidStudio 有 lint 问题
问题描述
当我像这样声明我attrs
的 at 子模块时:
<attr name="radius" format="dimension" />
<attr name="border" format="dimension" />
<attr name="border_color" format="reference|color" />
<declare-styleable name="RoundImageView">
<attr name="radius" />
<attr name="border" />
<attr name="border_color" />
</declare-styleable>
<declare-styleable name="CircleImageView">
<attr name="border" />
<attr name="border_color" />
</declare-styleable>
但是当我在我的应用程序中使用时,attr 无法自动提示:
顺便说一句,这在我运行应用程序时效果很好。只是有 lint 通知和属性没有提示。
解决方案
您的问题可能是因为属性名称冲突。尝试将您的属性更改为以下内容:
<attr name="radius" format="dimension" />
<attr name="border" format="dimension" />
<attr name="border_color" format="reference|color" />
<declare-styleable name="RoundImageView">
<attr name="riv_radius" />
<attr name="riv_border" />
<attr name="riv_border_color" />
</declare-styleable>
<declare-styleable name="CircleImageView">
<attr name="civ_border" />
<attr name="civ_border_color" />
</declare-styleable>
然后通过 View 类型使用 View 属性。
推荐阅读
- python - 无法导入接口:ModuleNotFoundError: No module named 'interface'
- java - TestNG 组不执行 @BeforeMethod
- php - 本地开发中的 ENV 缓存问题(PHP-FPM、NGINX 和 LARAVEL)
- angular - canActivate AuthGuard 不重定向到登录页面
- python - 在 MacOS Catalina 上安装 GDAL 失败
- python - “conv_base.output”和“conv_base.input”在这段代码中是什么意思或做什么?
- emacs - Emacs Cx C-; 评论行不工作
- python - 替换之前出现的单词
- jdbc - wso2连接mysql jdbc
- unity3d - 世界空间按钮点击事件优先于它在里面的对撞机的点击事件?