zoukankan      html  css  js  c++  java
  • java.lang.IllegalArgumentException: parameter must be a descendant of this view

    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();
        }
    }
  • 相关阅读:
    饿了么P7级前端工程师进入大厂的面试经验
    前端程序员面试的坑,简历写上这一条信息会被虐死!
    这次来分享前端的九条bug吧
    移动端开发必会出现的问题和解决方案
    创建一个dynamics 365 CRM online plugin (八)
    创建一个dynamics 365 CRM online plugin (七)
    创建一个dynamics 365 CRM online plugin (六)
    创建一个dynamics 365 CRM online plugin (五)
    使用User Primary Email作为GUID的问题
    怎样Debug Dynamics 365 CRM Plugin
  • 原文地址:https://www.cnblogs.com/kangweifeng/p/7645465.html
Copyright © 2011-2022 走看看