码迷,mamicode.com
首页 > 编程语言 > 详细

java.lang.IllegalArgumentException: parameter must be a descendant of this view

时间:2017-10-10 16:53:20      阅读:296      评论:0      收藏:0      [点我收藏+]

标签:list   解决方法   div   oid   pat   lis   bsp   end   chm   

Log信息

java.lang.IllegalArgumentException: parameter must be a descendant of this view
    at android.view.ViewGroup.offsetRectBetweenParentAndChild(ViewGroup.java:4555)
    at android.view.ViewGroup.offsetDescendantRectToMyCoords(ViewGroup.java:4492)
    at android.view.ViewRootImpl.scrollToRectOrFocus(ViewRootImpl.java:2659)
    at android.view.ViewRootImpl.draw(ViewRootImpl.java:2303)
    at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2252)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1882)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:999)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5663)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:777)
    at android.view.Choreographer.doCallbacks(Choreographer.java:587)
    at android.view.Choreographer.doFrame(Choreographer.java:557)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763)
    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:5345)
    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:855)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:671)
    at dalvik.system.NativeStart.main(Native Method)

bug出现的情况:Android系统4.4.2和4.4.4,在Listview适配子项中存在edittext编辑框,并且数据是超出一屏 。当即点击最后一项中的edittext弹出了软键盘 然后收缩父项后就出现异常。

 

解决方法

public View getView(int position, View convertView, ViewGroup parent) {
    //强制清除当前焦点
    Activity activity = (Activity) getContext();
    View currentFocus = activity.getCurrentFocus();
    if (currentFocus != null) {
        currentFocus.clearFocus();
    }
}

 

java.lang.IllegalArgumentException: parameter must be a descendant of this view

标签:list   解决方法   div   oid   pat   lis   bsp   end   chm   

原文地址:http://www.cnblogs.com/kangweifeng/p/7645465.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!