解决 android.view.ViewGroup$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
错误日志1:
06-13 10:55:50.410: E/KVLog(1129): Error info:java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams
06-13 10:55:50.423: E/KVLog(1129): Cause Result:java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams
06-13 10:55:50.423: E/KVLog(1129): at android.widget.FrameLayout.onLayout(FrameLayout.java:324)
一般设置LayoutParams的时候会报错,是因为LayoutParams有很多种,引用错误就会报错,那么如何快速解决这个错误呢
通过观察发现只要在日志信息中看到 at android.widget.FrameLayout.onLayout,(一般在cause result的下一行)那么onlayout前面显示的那个layout就是你真正要用到的layout,替换掉原来已用的layout,立刻解决问题!!!
错误日志2:
02-27 11:11:03.952: E/AndroidRuntime(3168): java.lang.ClassCastException: android.widget.FrameLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
02-27 11:11:03.952: E/AndroidRuntime(3168): at android.widget.GridView.onMeasure(GridView.java:1028)
02-27 11:11:03.952: E/AndroidRuntime(3168): at android.view.View.measure(View.java:12761)
通过观察发现只要在日志信息中看到错误日志第一行的信息,那么第一行中cannot be cast to 后面的layoutparams就是你要的真正的layoutparams,比如这个 android.widget.FrameLayout$LayoutParams是错误的,而cannot be cast to后面的android.widget.AbsListView$LayoutParams是对的
本文转自:http://www.eoeandroid.com/blog-594702-3235.html
解决 android.view.ViewGroup$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams的更多相关文章
- java.lang.ClassCastException: android.view.AbsSavedState$1 cannot be cast to android.widget.ProgressBar$SavedState
java.lang.ClassCastException: android.view.AbsSavedState$1 cannot be cast to android.widget.Progress ...
- java.lang.ClassCastException: android.view.ViewGroup$LayoutParams cannot be cast to android.widget.L(转)
09-09 10:19:59.979: E/AndroidRuntime(2767): FATAL EXCEPTION: main09-09 10:19:59.979: E/AndroidRuntim ...
- android.widget.FrameLayout$LayoutParams cannot be cast to android.widget.LinearLayout$LayoutParams
http://blog.csdn.net/lilu_leo/article/details/11952717 有时候需要在在代码中设置LayoutParams,自己为一个FrameLayout设置 ...
- java.lang.ClassCastException: android.widget.RelativeLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
java.lang.ClassCastException: android.widget.RelativeLayout$LayoutParams cannot be cast to android.w ...
- 深入懂得android view 生命周期
作为自定义 view 的基础,如果不了解android view 的生命周期 , 那么你将会在后期的维护中发现这样那样的问题 ....... 做过一段时间android 开发的同学都知道,一般 on ...
- 深入理解android view 生命周期
作为自定义 view 的基础,如果不了解Android view 的生命周期 , 那么你将会在后期的维护中发现这样那样的问题 ....... 做过一段时间android 开发的同学都知道,一般 on ...
- bug_ _ android.view.InflateException: Binary XML file line #2: Error inflating class <unknown
========= 5.0 android异常“android.view.InflateException: Binary XML file line # : Error inflating ...
- bug_ _ android.view.WindowManager$BadTokenException: Unable to add window -- token
========4 关于android的一个常见错误:Unable to add window --token is not valid android.view.WindowManage ...
- Android Studio:Unable to add window android.view.ViewRootImpl$W@5e2d85a -- permission denied for this window 第一行代码
学习<第一行代码>的时候,出现的错误. java.lang.RuntimeException: Unable to start receiver com.example.sevenun.l ...
随机推荐
- linux RedHat6.4下nginx安装
安装rpm 检测是否有已安装rpm包: rpm–qa | grep pcre rpm–qa | grep zlib rpm–qa | grep openssl 若没有则需安装(这些包可以在redhat ...
- redis 安装注意事项
redis安装 1.redis 安装 官网地址:http://redis.io/download $ wget http://download.redis.io/releases/redis-3.0. ...
- Linux启用MySQL的InnoDB引擎
前几天公司的一个项目组的同事反应说公司内部的一台Linux服务器上的MySQL没有InnoDB这个引擎,我当时想应该不可能啊,MySQL默认应该 就已经安装了这个引擎的吧,于是上服务器去看了看,发现还 ...
- RAC 安装完成后 节点间通信不依赖于SSH
RAC 安装完成后,想修改ssh 的端口.google了一下.原文https://community.oracle.com/thread/2444594?tstart=0 原文说的是11g,10g也好 ...
- theano log softmax 4D
def softmax_4d(x_4d): """ x_4d: a 4D tensor:(batch_size,channels, height, width) &quo ...
- js正则匹配查找
var pattern1 = /好/g; console.log(pattern1.test("你好")); 字符串查找: var pattern1 = /\w/; console ...
- PHP reset() 函数
定义和用法 reset()函数把数组的内部指针指向第一个元素,并返回这个元素的值.若失败,则返回 FALSE. reset()函数用来将数组指针设置回数组的开始位置.如果需要在一个脚本中多次查看或处理 ...
- Linux中断处理流程
http://blog.csdn.net/dianhuiren/article/details/7468956
- live555
相关资料: Live555 是一个为流媒体提供解决方案的跨平台的C++开源项目,它实现了对标准流媒体传输协议如RTP/RTCP.RTSP.SIP等的支持.Live555实现 了对多种音视频编码格式的音 ...
- JAVA实现word doc docx pdf excel的在线浏览 - 仿百度文库 源码
我们具体实现思路是这样的 首先下载并安装openoffice和swftools openoffice下载地址:http://www.openoffice.org/download/index.html ...