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: main
09-09 10:19:59.979: E/AndroidRuntime(2767): java.lang.ClassCastException: android.view.ViewGroup$LayoutParams cannot be cast to android.widget.LinearLayout$LayoutParams
09-09 10:19:59.979: E/AndroidRuntime(2767): at android.widget.LinearLayout.measureVertical(LinearLayout.java:634)
09-09 10:19:59.979: E/AndroidRuntime(2767): at android.widget.LinearLayout.onMeasure(LinearLayout.java:553)
09-09 10:19:59.979: E/AndroidRuntime(2767): at android.view.View.measure(View.java:12758)
09-09 10:19:59.979: E/AndroidRuntime(2767): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)
09-09 10:19:59.979: E/AndroidRuntime(2767): at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
09-09 10:19:59.979: E/AndroidRuntime(2767): at android.view.View.measure(View.java:12758)
09-09 10:19:59.979: E/AndroidRuntime(2767): at android.widget.LinearLayout.measureVertical(LinearLayout.java:812)
09-09 10:19:59.979: E/AndroidRuntime(2767): at android.widget.LinearLayout.onMeasure(LinearLayout.java:553)
09-09 10:19:59.979: E/AndroidRuntime(2767): at android.view.View.measure(View.java:12758)
09-09 10:19:59.979: E/AndroidRuntime(2767): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)
09-09 10:19:59.979: E/AndroidRuntime(2767): at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)
09-09 10:19:59.979: E/AndroidRuntime(2767): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2092)
09-09 10:19:59.979: E/AndroidRuntime(2767): at android.view.View.measure(View.java:12758)
09-09 10:19:59.979: E/AndroidRuntime(2767): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1064)
09-09 10:19:59.979: E/AndroidRuntime(2767): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2445)
09-09 10:19:59.979: E/AndroidRuntime(2767): at android.os.Handler.dispatchMessage(Handler.java:99)
09-09 10:19:59.979: E/AndroidRuntime(2767): at android.os.Looper.loop(Looper.java:137)
09-09 10:19:59.979: E/AndroidRuntime(2767): at android.app.ActivityThread.main(ActivityThread.java:4424)
09-09 10:19:59.979: E/AndroidRuntime(2767): at java.lang.reflect.Method.invokeNative(Native Method)
09-09 10:19:59.979: E/AndroidRuntime(2767): at java.lang.reflect.Method.invoke(Method.java:511)
09-09 10:19:59.979: E/AndroidRuntime(2767): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
09-09 10:19:59.979: E/AndroidRuntime(2767): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
09-09 10:19:59.979: E/AndroidRuntime(2767): at dalvik.system.NativeStart.main(Native Method)
报错原因:
ImageView image =(ImageView) findViewById(R.id.imageView1);
image.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
解决方法:
ImageView image =(ImageView) findViewById(R.id.imageView1);
image.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
小结:
遇到问题时,解决思路有哪些,强化下,第一理清问题环境和背景,如查看如上错误提示,马上就可以定位问题,快速解决。第二、三、四,
其实它不算是问题。为了强化这种思路,在此记录下。
java.lang.ClassCastException: android.view.ViewGroup$LayoutParams cannot be cast to android.widget.L(转)的更多相关文章
- 解决 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.Li ...
- 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-Spring:java.lang.ClassCastException: com.sun.proxy.$Proxy* cannot be cast to***问题解决方案
java.lang.ClassCastException: com.sun.proxy.$Proxy* cannot be cast to***问题解决方案 临床表现: 病例: 定义代理类: @Tra ...
- java.lang.ClassCastException: org.slf4j.impl.Log4jLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext问题原因及解决方法
一.错误信息 java.lang.ClassCastException: org.slf4j.impl.Log4jLoggerFactory cannot be cast to ch.qos.logb ...
- java.lang.ClassCastException: com.sun.proxy.$Proxy32 cannot be cast to com.bkc.bpmp.core.cache.MemcachedManager
java.lang.ClassCastException: com.sun.proxy.$Proxy32 cannot be cast to com.bkc.bpmp.core.cache.Memca ...
- 关于利用动态代理手写数据库连接池的异常 java.lang.ClassCastException: com.sun.proxy.$Proxy0 cannot be cast to java.sql.Connection
代码如下: final Connection conn=pool.remove(0); //利用动态代理改造close方法 Connection proxy= (Connection) Proxy.n ...
- java.lang.ClassCastException: com.sun.proxy.$Proxy2 cannot be cast to...异常
异常: Exception in thread "main" java.lang.ClassCastException: com.sun.proxy.$Proxy2 cannot ...
- WebLogic部署报java.lang.ClassCastException: weblogic.xml.jaxp.RegistrySAXParserFactory cannot be cast to javax.xml.parsers.SAXParserFactory
今天在部署WebLogic项目时,报了java.lang.ClassCastException: weblogic.xml.jaxp.RegistrySAXParserFactory cannot b ...
- Caused by: java.lang.ClassCastException: org.springframework.web.SpringServletContainerInitializer cannot be cast to javax.servlet.ServletContainerInitializer错误解决办法
严重: Failed to initialize end point associated with ProtocolHandler ["http-bio-8080"] java. ...
随机推荐
- dedecms---------自由列表标题:网站地图自由列表
列表HTML存放目录:{cmspath}/ 目录默认页名称:sitemap.xml 命名规则:{listdir}/sitemap.xml 列表模板:{style}/map.htm 循环内的单行记录样式 ...
- 关于android:configChanges的属性
一般在AndroidManifest.xml文件中都没有使用到android:configChanges="keyboardHidden|orientation"配置,当然还是很有 ...
- C语言学习之笔记
第一章 概述 1. C语言的特点 ①语言简洁.紧凑,使用方便.灵活.共有32个关键字(也称保留字),9种控制语句. ②运算符丰富,共有34种运算符. ③数据结构丰富,数据类型有:整型.实型.字符型.数 ...
- jquery cleditor 光标经常点不进去问题解决方法 bootstrap 富文本框 控件
cleditor 光标点不进去,原因是内嵌的html代码段 body没有赋值默认高度. 解决方法1.赋值options.bodyStyle 设置min-height值.缺点:不能跟随设备更新最低高度 ...
- C# mvc3 mvc4 伪静态及IIS7.5配置
mvc3 mvc4路由配置 //单独路由 routes.MapRoute( name: "XXX", url: "Home/XXX.html/{id}&quo ...
- 关于移动手机端富文本编辑器qeditor图片上传改造
日前项目需要在移动端增加富文本编辑,上网找了下,大多数都是针对pc版的,不太兼容手机,当然由于手机屏幕小等原因也限制富文本编辑器的众多强大功能,所以要找的编辑器功能必须是精简的. 找了好久,发现qed ...
- 转:.NET 环境中使用RabbitMQ
原文来自于:http://blog.jobbole.com/83819/ 原文出处: 寒江独钓 欢迎分享原创到伯乐头条 在企业应用系统领域,会面对不同系统之间的通信.集成与整合,尤其当面临异构系统 ...
- 搭建一个 简易的php版 todolist
我记得以前使用 wunderlist 但是国外..后来用了半年. 挺方便的.但是.后来慢慢忘了这工具存在 缺少了todolist.效率折半.. so.我搭建了个简单的todolist. :mytin ...
- vijos1514天才的记忆
P1514天才的记忆 背景 神仙飞啊飞 描述 从前有个人名叫W and N and B,他有着天才般的记忆力,他珍藏了许多许多的宝藏.在他离世之后留给后人一个难题(专门考验记忆力的啊!),如果谁能轻松 ...
- ZOJ-3597-Hit the Target!(线段树+扫描线)
题解引自:http://www.cnblogs.com/wuyiqi/archive/2012/04/28/2474614.html 这题和着题解一块看,看了半天才看懂的....菜菜.... 题意:有 ...