我正在尝试在 mainActivity
上创建一个按钮。单击后,会将用户带到第二个 View 。但是我一直收到错误提示
onclick listener cannot be resolved to a type
和
the method set onclicklistener in the type view is not applicaible for the type of arguments
代码截图如下:
有没有人有什么想法?
最佳答案
这是因为您的源文件仍然缺少您要使用的类所需的导入。
您始终可以使用 Eclipse 自动添加缺少的导入:
Ctrl+Shift+O
这样您就不必猜测需要导入哪个包。
关于android - 出现 "cannot be resolved to a type"错误时我该怎么办?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6017679/