java.lang.IllegalStateException: Could not find method myClick(View) in a parent or ancestor Context for android:onClick attribute defined on view class com.google.android.material.button.MaterialButt

Android开发报错:

java.lang.IllegalStateException: Could not find method myClick(View) in a parent or ancestor Context for android:onClick attribute defined on view class com.google.android.material.button.MaterialButton.

我的错误点:函数写成private了,直接去掉也会出错,要写成public,此时myClick也变成黄色了,然后跳转成功了。

 

 

posted on 2023-03-07 22:14  201812  阅读(286)  评论(0编辑  收藏  举报