例如,下面一段响应点击事件的 Android Kotlin 代码:
fun clickResetBtn(view: View) {
binding.x1.setText("")
}
在编译时,会看到警告信息:
Parameter 'view' is never used
解决方法
使用 @Suppress("UNUSED_PARAMETER")
fun clickResetBtn(@Suppress("UNUSED_PARAMETER")view: View) {
binding.x1.setText("")
}