我在我的应用中遇到了一些关键问题。
拥有简单的列表视图,并在项目点击时以这种方式显示 AlertDialog.Builder :
AlertDialog.Builder alert = new AlertDialog.Builder(getActivity());
alert.setTitle("Credits finished , Upgrade Now.");
alert.setMessage("Enter coupon code");
final EditText input = new EditText(getActivity());
alert.setView(input);
.
.
.
.
点击该项目后发生异常,而不是点击警告对话框中的edittext,android打开虚拟键盘,然后抛出此异常
java.lang.IllegalArgumentException: parameter must be a descendant of this view
at android.view.ViewGroup.offsetRectBetweenParentAndChild(ViewGroup.java:4548)
at android.view.ViewGroup.offsetDescendantRectToMyCoords(ViewGroup.java:4485)
at android.view.ViewRootImpl.scrollToRectOrFocus(ViewRootImpl.java:2660)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2304)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2253)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1883)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5670)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
at android.view.Choreographer.doCallbacks(Choreographer.java:574)
at android.view.Choreographer.doFrame(Choreographer.java:544)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
在这里阅读了一些线程之后,我猜测它可能与视图的关注或者与InputMethod错误处理虚拟键盘相关,但没有找到可以解决它的结果。
很高兴知道以前是否有人遇到过这个问题,可以帮助我。
非常感谢您的帮助