微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android – 自定义Lint规则:如何处理修复按钮单击

我遵循了this教程,它对我来说非常适合.现在我想添加修复问题功能.我正在使用Eclipse.

在Lint Warnings视图中我们有Fix按钮,我可以处理吗?

例如,当您单击CTRL 1时,我们在TextView中有硬编码字符串(android:text =“Test”),帮助弹出窗口打开,可能会提取字符串.我想要做的是添加提取硬编码的dp值功能.

如果你能指出我在哪里可以找到已经实现的lint问题的源代码,那也很棒.

谢谢.

最佳答案
Lint检查可以单独编写:

>写一个Lint检查:http://tools.android.com/tips/lint/writing-a-lint-check
> Lint检查来源:https://android.googlesource.com/platform/tools/base/+/master/lint/libs/lint-checks/src/main/java/com/android/tools/lint/checks

Lint修复是ADT插件的一部分:http://tools.android.com/tips/lint

Lint is integrated with ADT 16 and later. The integration offers a few features above the command line version of lint:

  • Automatic fixes for many warnings
  • Lint gets run automatically on varIoUs editing operations
  • Ability to suppress types of errors as well as specific instances of an error
  • Ability to configure issue severities
  • Jump directly to the problem source from the lint view

原文地址:https://www.jb51.cc/android/430721.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐