java.lang.ClassCastException~android.widget.ImageView cannot be cast to android.widget.Button~
来源:互联网 发布:html标签中使用js变量 编辑:程序博客网 时间:2024/05/23 02:02
当修改布局XML文件。。或者java的时候。。感觉应该没什么不对的,就那么出现了错误。。。
错误提示有很多种。。
错误提示:
java.lang.ClassCastException: android.widget.ImageView cannot be cast to android.widget.TextView
java.lang.ClassCastException: android.widget.ImageView cannot be cast to android.widget.Button
等等等等。。。。
解决方法:
1. 有时候是java文件对应的控件名称错误。。。 比如java是button,然后xml改成了textview。。
2.xml中更改布局,替换了父viewGroup,比如说从当前LinearLayout移动到另一个RelativeLayout,理论上来说还是控件名称更改了。。
3.可能是之前编译生成的.class文件与新的java内容冲突,这个问题遇见了好几次。。 点击项目->clean。 重新生成.class文件解决~
暂时没有碰到别的问题... 但是大部分都是控件之间的问题
0 0
- java.lang.ClassCastException~android.widget.ImageView cannot be cast to android.widget.Button~
- Android: java.lang.ClassCastException: android.widget.imageView cannot be cast to android.widget.tex
- java.lang.ClassCastException: android.widget.ImageView cannot be cast to android.widget.TextView解决办法
- 关于java.lang.ClassCastException: android.widget.Button cannot be cast to android.widget.Edit 错误的解决
- java.lang.ClassCastException: android.widget.LinearLayout cannot be cast to android.widget.TextView
- java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.EditText
- java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.LinearLayout
- java.lang.ClassCastException: android.widget.RelativeLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutPara
- Caused by: java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.Bu
- java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.EditText
- java.lang.ClassCastException: android.widget.ProgressBar cannot be cast
- ClassCastException: android.widget.ImageView cannot be cast to android.widget.TextView
- ClassCastException:android.widget.ImageView cannot be cast to android.widget.RelativeLayout
- java.lang.ClassCastException: android.view.ViewGroup$LayoutParams cannot be cast to android.widget.L
- java.lang.ClassCastException: android.widget.RelativeLayout$LayoutParams cannot be cast to android.w
- java.lang.ClassCastException: android.widget.HeaderViewListAdapter cannot be cast to com.android.mms
- java.lang.ClassCastException: android.widget.FrameLayout$LayoutParams cannot be cast to android.widg
- java.lang.ClassCastException: android.widget.FrameLayout$LayoutParams cannot be cast to android.widg
- 优雅的图片翻转实现方式rollover.js
- Qt之拖放
- 网站接入QQ登录
- http的状态码 300-301-302-303-304-305-307
- Cocos2d-lua自动重新加载SpriteFrames
- java.lang.ClassCastException~android.widget.ImageView cannot be cast to android.widget.Button~
- solr全文检索(第二篇 solr的实例)--源自技术
- 拍照(从本地获取存储在SD卡中)
- jsp ,servlet中session ,Cookie 相关知识
- 【翻译】Xibo官方文档12-Layout-Region
- 算法系列之十四:狼、羊、菜和农夫过河问题
- 排序算法-选择排序 Selection Sort
- xmpp 视频
- 因为我是姑娘,所以不想像你一样安逸生活