我在上个月随机遇到此问题:
java.lang.IllegalArgumentException: parameter must be a descendant of this view
at android.view.ViewGroup.offsetRectBetweenParentAndChild(ViewGroup.java:4479)
at android.view.ViewGroup.offsetDescendantRectToMyCoords(ViewGroup.java:4416)
at android.view.ViewRootImpl.scrollToRectOrFocus(ViewRootImpl.java:2656)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2300)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2249)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1882)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1009)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5508)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
at android.view.Choreographer.doCallbacks(Choreographer.java:562)
at android.view.Choreographer.doFrame(Choreographer.java:532)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:5225)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(NativeStart.java)
经过大量的挖掘和测试,我发现是在更新Appcompat lib(
android-support-v7-appcompat
)之后于10月27日引入了该问题。最新版本的Appcompat似乎无法解决此问题。我认为该问题与类似的错误(例如this question)无关,因为我隔离了在我的存储库中引入该问题的提交,并且该提交包含Appcompat的更新。
有什么线索吗?有人有同样的问题吗?
最佳答案
您应该在 XML 中尝试以下操作:
android:descendantFocusability="beforeDescendants"
关于android - 在ViewGroup.offsetRectBetweenParentAndChild中应用 “java.lang.IllegalArgumentException: parameter must be a descendant of this view”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27543665/