Android Lint将此代码示例中的字符串常量作为"dWQGSCDx“的拼写错误。根据文档,我应该使用@SupressLint("Typos")来抑制它,但这不能实现这一点。我看到其他人建议使用@SuppressWarning,但这也不起作用。
/**
* Constants.kt
*/
import android.annotation.SuppressLint
@SuppressLint("Typos")
@SuppressWarnings("SpellCheckingInspection")
const val SOME_STRING_VALUE = "...dWQGSCDx..."
注意:这是一个文件范围内的全局常量,它不在类内,因此不能将注释放在包含类上。
如何在不完全禁用拼写检查的情况下禁止该常量定义的拼写检查,并且不向字典中添加"mispelt“文本?
发布于 2018-09-21 18:58:30
在Kotlin中,您可以使用@Suppress
而不是带有以下注释的@SuppressWarnings
来取消此警告
@Suppress("SpellCheckingInspection")
https://stackoverflow.com/questions/47748808
复制相似问题