错误日志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. ssh: connect to host xxx.xxx.xxx.xxx port 22: Connection refused

    工具/原料:Ubuntu 在采用scp在不同机器之间进行文件拷贝时出现标题所示的错误,原因可能是: 1.sshd 未启动 2.sshd 未安装 3.防火墙 4需重新启动ssh 服务 查看sshd进程方 ...

  2. mysql 的rmp安装

    新文档/* GitHub stylesheet for MarkdownPad (http://markdownpad.com) *//* Author: Nicolas Hery - http:// ...

  3. Linux中的时间和时间管理

    Coordinated Universal Time(UTC):协调世界时,又称为世界标准时间,也就是大家所熟知的格林威治标准时间(Greenwich Mean Time,GMT).比如,中国内地的时 ...

  4. W3C盒子与IE盒子模型

    盒模型: 内容(content).填充(padding).边界(margin). 边框(border) IE的content部分把 border 和 padding计算了进去 例:一个盒子的 marg ...

  5. 请求与通配符 mime 映射相匹配。请求映射到静态文件处理程序。如果有不同的前提条件,请求将映射到另一个处理程序。

    打开IIS管理器,找到“处理程序映射”,在列表右击选择“添加脚本映射”即可.eg:*.aspx,将该类型的页面的处理程序映射为“%windir%\Microsoft.NET\Framework\v4. ...

  6. pc telnet 登录 android 系统

    前提是:1) 手机已经root,且装有busybox,2) 还装有至少一款terminal(模拟终端)软件,手机连wifi路由器.3) 还要有一些基础常识,比如linux命令,telnet.这里模拟终 ...

  7. cocos2d-x学习笔记------动画人物跑起来吧!

    学习总结: 1.sprintf用来格式化字符串 2.CCSpriteFrame:: frameWithTexture通过图片名创建的时候需要的参数Texture2D创建使用CCTextureCache ...

  8. ECshop网店系统百万级商品量性能优化-加快首页访问速度

    如果ECshop的商品数达到几万,十几万的时候,如果首页没有缓存,第一次访问的时候,你会发现其慢无比,原因就是清空了Cache后或者没有Cache的情况下,ECshop会Bulid一些Cache数据, ...

  9. web2py--------------用web2py写 django的例子 --------建立一个投票应用(2)

    建立模型 我们在models下及那里polls.py 文件内容如下 # -*- coding: utf-8 -*- pollsdb=DAL(uri='sqlite://polls.db') polls ...

  10. Python 爬虫入门(requests)

    相信最开始接触Python爬虫学习的同学最初大多使用的是urllib,urllib2.在那之后接触到了第三方库requests,requests完全能满足各种http功能,真的是好用爆了 :D 他们是 ...