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

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...