解决 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 ...
随机推荐
- CI获取ip的API
header("Content-type:text/html;charset=utf-8"); // p($this->input->ip_address()); // ...
- 实现scp自动输入密码(判断yesno选项)
1.apt-get install expect 2.编写shell脚本test.sh #!/usr/bin/expect -f#!/bin/shset password 1spawn scp roo ...
- mysql---左连接、右连接、内连接之间的区别与联系
现有两张表 第一张表为男生表,记录了男生的姓名和配偶的编号 第二张表为女生表,记录了女生的姓名和自己的编号 第一种情况:主持人请所有男生都上台,并且带上自己的配偶.这时不管男生有没有配偶都要上台,所以 ...
- ASP.NET MVC Web API使用示例
上篇博客讲解rest服务开发时,曾经提到过asp.net mvc中的rest api,由于篇幅原因,没有在上篇博客中进行讲解,这里专门拿出来进行讨论.还是一样引用上次的案例,用asp.net mvc提 ...
- appcan 跨窗口处理方法 appcan.window.evaluateScript({name,scriptContent,type})使用解读
appcan.window.evaluateScript({ name,/*主窗口名称,此窗口要先用appcan.window.open打开了,才能找到,此方法才会有效*/ scriptContent ...
- Ubuntu下安装php调试工具xdebug
安装xdebug: sudo apt-get install php-pear sudo apt-get install php5-dev pecl install xdebug 创建配置文件: /x ...
- Linux操作命令(一)
ls 命令 ls 命令是 linux 下最常用的命令,ls 命令就是 list 的缩写. ls 用来打印出当前目录的清单.如果 ls 指定其他目录,那么就会显示指定目录里的文件及文件夹清单. 通过 l ...
- 基于C#的SolidWorks插件开发(2)--创建插件
在项目工程中可以看到SwAddin.cs文件.这个文件是插件的核心文件,包括插件的名称,注册表项,菜单,以及菜单的回调函数都在该文件中实现. 1.修改插件的名称和描述 Guid为插件生成后注册到注册表 ...
- 【BZOJ】1070: [SCOI2007]修车
1070: [SCOI2007]修车 Description 同 一时刻有N位车主带着他们的爱车来到了汽车维修中心.维修中心共有M位技术人员,不同的技术人员对不同的车进行维修所用的时间是不同的.现在需 ...
- poj 3667 Hotel (线段树)
http://poj.org/problem?id=3667 Hotel Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 94 ...