先贴异常信息:
java.lang.IllegalArgumentException: parameter must be a descendant of
this view
at
android.view.ViewGroup.offsetRectBetweenParentAndChild(ViewGroup.java:4579)
at
android.view.ViewGroup.offsetDescendantRectToMyCoords(ViewGroup.java:4516)
at
android.view.ViewRootImpl.scrollToRectOrFocus(ViewRootImpl.java:3217)
at
android.view.ViewRootImpl.draw(ViewRootImpl.java:2719)
at
android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2666)
at
android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2278)
at
android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1066)
at
android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6245)
at
android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
at
android.view.Choreographer.doCallbacks(Choreographer.java:580)
at
android.view.Choreographer.doFrame(Choreographer.java:550)
at
android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
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:5117)
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:785)
at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at
dalvik.system.NativeStart.main(Native Method)
看一场没发现关于业务程序造成的遗产堆栈信息
,开始有点头大。茫茫大沙漠就只能搜寻点点滴滴的。
后发现于“http://stackoverflow.com/questions/7100555/preventing-catching-illegalargumentexception-parameter-must-be-a-descendant-of
”有点路子 尝试一下可以。
喷然欣慰。
至于解决的代码
View currentFocus =((Activity)mContext).getCurrentFocus(); if(currentFocus !=null){
currentFocus.clearFocus(); }
代码从字面理解上讲当前的获得的焦点的view
清理。
在说明下使用的背景:魅族手机上(其他手机没出现这样情况),在可展开BaseExpandableListAdapter适配子项中存在edittext编辑框,并且数据是超出一屏
。当即点击最后一项中的edittext弹出了软键盘 然后收缩父项后就出现异常。