我已经为 Android 中的 EditText 小部件编写了 setOnKeyListener 代码。但我会很困惑为什么会出现错误。下面是我的代码
我按照书上的教程进行操作。但还是报错。你能给我一个解决方案吗?
最佳答案
您正在导入android.content.DialogInterface.OnKeyListener
。您要导入的是 android.view.View.OnKeyListener
。
当您导入 android.content.DialogInterface.OnKeyListener
时,Eclipse 会尝试在 EditText
中查找需要 android 的
作为参数,但这样的方法不存在。setOnKeyListener
方法.content.DialogInterface.OnKeyListener
关于java - 设置OnKeyListener函数错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30072664/