Android解决"parameter must be a descendant of this view(参数必须是此视图的子视图 )"问题的方法
2016-09-20 13:44
786 查看
1.简介
parameter must be a descendant of this view的中文意思是‘参数必须是此视图的子视图“,言外之意所有view必须嵌套在同一个父级布局中。在通过findViewById方法获得view对象时,所有view的引用必须统一,比如都是用this来引用。我在做的时候是在ListView的点击事件中使用当前view来查询textView的控件,从而获取textView的内容,所以这个引用可能是不一致的,但是当我改变方法不再使用查找控件来获取内容时,还是报了这个错误,于是,前面红色字体的解释可能还有另一层意思。2.解决方法
View currentFocus = this.getCurrentFocus(); if (currentFocus != null) { currentFocus.clearFocus(); }
这段代码的作用是将当前获取到的焦点清除,我在清除前将键盘隐藏了,这样就解决了当软键盘弹出时点击字母栏出现异常的问题。
但是随之又出现了新的问题,既然我已经清楚了当前点击的view的焦点,为什么点击后还能定位联系人呢?
相关文章推荐
- 【转载】Parameter must be a descendant of this view问题的解决方案
- Android java.lang.IllegalArgumentException: parameter must be a descendant of this view
- 【原创】【ViewFlow+GridView】Parameter must be a descendant of this view问题分析
- android-奇异bug:parameter must be a descendant of this view
- 错误 java.lang.IllegalArgumentException: parameter must be a descendant of this view 的解决方案
- java.lang.IllegalArgumentException: parameter must be a descendant of this view
- Parameter must be a descendant of this view 错误
- 错误 java.lang.IllegalArgumentException: parameter must be a descendant of this view 的解决方案
- java.lang.IllegalArgumentException: parameter must be a descendant of this view
- java.lang.IllegalArgumentException: parameter must be a descendant of this view
- java.lang.IllegalArgumentException parameter must be a descendant of this view
- 解决ORA-02069: global_names parameter must be set to TRUE for this operation 问题
- JMeter学习-027-JMeter参数文件(脚本分发)路径问题:jmeter.threads.JMeterThread: Test failed! java.lang.IllegalArgumentException: File distributed.csv must exist and be readable解决方法
- 关于Android Studio "This version of android studio is incompatible with the gradle version used."的解决方法
- 问题解决: Attribute value request.getParameter("id") is quoted with " which must be escaped when used wi
- android TextView多行文本(超过3行)使用ellipsize="end"属性无效问题的解决方法
- 问题解决: Attribute value request.getParameter("id") is quoted with " which must be escaped when used within the value
- 解决itunesconnect上传时"at least one of the following architecture(s) must be present:armv6"问题
- MPI编译C++程序出现#error "SEEK_SET is #defined but must not be for the C++ binding of MPI" 的解决方法
- 问题解决: Attribute value request.getParameter("id") is quoted with " which must be escaped when used wi