错误日志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的更多相关文章

  1. 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 ...

  2. 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 ...

  3. android.widget.FrameLayout$LayoutParams cannot be cast to android.widget.LinearLayout$LayoutParams

      http://blog.csdn.net/lilu_leo/article/details/11952717 有时候需要在在代码中设置LayoutParams,自己为一个FrameLayout设置 ...

  4. 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 ...

  5. 深入懂得android view 生命周期

    作为自定义 view 的基础,如果不了解android  view 的生命周期 , 那么你将会在后期的维护中发现这样那样的问题 ....... 做过一段时间android 开发的同学都知道,一般 on ...

  6. 深入理解android view 生命周期

    作为自定义 view 的基础,如果不了解Android  view 的生命周期 , 那么你将会在后期的维护中发现这样那样的问题 ....... 做过一段时间android 开发的同学都知道,一般 on ...

  7. 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 ...

  8. bug_ _ android.view.WindowManager$BadTokenException: Unable to add window -- token

    ========4       关于android的一个常见错误:Unable to add window --token is not valid android.view.WindowManage ...

  9. 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 ...

随机推荐

  1. 24种设计模式--访问者模式【Visitor Pattern】

    今天天气不错,绝对是晴空万里,骄阳似火呀,好,我们今天来讲访问者模式,我们在前面讲了组合模式和迭代器模式,通过组合模式我们能够把一个公司的人员组织机构树搭建起来,给管理带来非常大的便利,通过迭代器模式 ...

  2. Apache服务

    Apache服务的安装: Apache服务程序的软件包名称是:httpd 安装方法: rpm软件包安装.源码编译安装.yum安装 yum install httpd 安装完成后启动: revice h ...

  3. WF4的数据库 表

    WF4的数据库 表 SQL 建表 SqlPersistenceProviderSchema.sql InstanceData 实例数据表 SqlPersistenceService_Schema.sq ...

  4. /dev/null 2>&1 解释(转)

    cmd >a 2>a 和 cmd >a 2>&1 为什么不同? cmd >a 2>a :stdout和stderr都直接送往文件 a ,a文件会被打开两遍, ...

  5. Mysql ID重新排列

    我们经常会遇到,在删除数据库某条记录时,原来的ID排序会有间隔,比如删除了ID为8的数据,这个表的ID排序就会从7直接到9, 那我们如何解决这个ID重新排列的问题呢? 只需一下三步: 1.删除这个表的 ...

  6. RasAPI函数实现PPPOE拨号

    unit uDial; interface uses Windows,Messages, SysUtils, Ras;// Classes; var //EntryName,UserName,Pass ...

  7. cocos2dx输出信息重定向到控制台

    重定向输出到控制台,方便调试,代码: // uncomment below line, open debug console #define USE_WIN32_CONSOLE int APIENTR ...

  8. 基于strpos()函数的判断用户浏览器方法

    $_SERVER['HTTP_USER_AGENT'],超全局变量,用来读取客户用的什么浏览器及其版本. strpos(),指定一个字符并搜索是否包含该字符. <html> <hea ...

  9. uva 12654

    dp,用优先队列存,上个节点节点覆盖下来的长度: 不过还不是很明白: #include<cstdio> #include<queue> #include<algorith ...

  10. jquery mobile event

    jquery.js $(document).on("mobileinit", function() { // }); jquery.mobile.js $(document).re ...