• 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();
        }
    }
  • 相关阅读:
    Dapper笔记-Dapper.Common【转】
    ASP.Net Core WebApi几种版本控制对比【转】
    ASP.NET Core WebAPI使用Swagger生成文档
    K8S笔记-Pod介绍【未完成】
    Docker-容器命令
    MySQL笔记-备份命令(mysqldump)
    MySQL笔记-INFORMATION_SCHEMA数据库介绍【转】
    Quartz.net笔记-计划任务触发器(Cron Trigger)
    Quartz.net笔记-简单触发器(Simple Trigger)
    Type序列化器
  • 原文地址:https://www.cnblogs.com/kangweifeng/p/7645465.html
Copyright © 2020-2023  润新知