Android 如何抑制资源xml文件中特定行/字符串上的lint?

Android 如何抑制资源xml文件中特定行/字符串上的lint?,android,xml,translation,lint,suppress,Android,Xml,Translation,Lint,Suppress,在Android上,我想在string.xml或其他资源文件中的特定字符串值或特定行上抑制lint <string name="suppress_lint_string">Suppress this String</string> <string name="dont_suppress_lint_string">Don\'t Suppress this String</string> 抑制此字符串 不要抑制此字符串 我想对特定字符串和布局的特

在Android上,我想在string.xml或其他资源文件中的特定字符串值或特定行上抑制lint

<string name="suppress_lint_string">Suppress this String</string>

<string name="dont_suppress_lint_string">Don\'t Suppress this String</string>
抑制此字符串
不要抑制此字符串

我想对特定字符串和布局的特定部分执行特定lint抑制,例如缺少特定字符串的翻译,这在不同语言之间并不重要。

如果要抑制特定字符串中的特定规则而不抑制整个文件,可以使用注释

strings.xml


忽略我的翻译
...
您可以用任何其他lint规则替换MissingTranslation


谢谢您的帮助。不过,请注意,在这种情况下,抑制是使用注释而不是注释来完成的。您可能认为将tools:ignore=“PluralsCandidate”添加到标记也会起作用,但事实并非如此:-请注意,您必须在lint规则前面加上“AndroidLint”。因此,如果要抑制未使用的字符串资源,请添加:
<?xml version="1.0" encoding="utf-8"?>
<resources>    

    <!--suppress MissingTranslation -->
    <string name="suppress_lint_string">ignore my translation</string>
    ...

</resources>