我设计了一个表格,其中我有一个编号为“Pre_tax_amount_ET”的EditText
并在日志中记录此错误
java.lang.IllegalStateException: Could not find method pretaxamount(View) in a parent
or ancestor Context for android:onClick attribute defined on view class android.support.v7.widget.AppCompatEditText with id 'Pre_tax_amount_ET'
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.resolveMethod(AppCompatViewInflater.java:307)
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:266)
at android.view.View.performClick(View.java:4191)
at android.view.View$PerformClick.run(View.java:17229)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4960)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(Native Method)
我现在知道它的全部内容可以有人帮忙吗?
答案 0 :(得分:1)
您的父视图或膨胀的xml文件中不存在您的视图(Edittext)。检查您的xml文件是否包含该视图。并且如果可能的话也发布你的xml代码