TextView can not be cast to ViewGroup
来源:互联网 发布:可以在家干的工作 知乎 编辑:程序博客网 时间:2024/06/05 10:24
转发地址:http://www.lai18.com/content/623002.html
错误提示:
java.lang.ClassCastException: android.widget.ImageView cannot be cast to android.widget.TextView
出现原因:
xml中更改布局,替换了父viewGroup,比如说从当前LinearLayout移动到另一个RelativeLayout
解决办法:
检查一下之前有没有使用LayoutParams,如果有,将【原来ViewGroup】.LayoutParams改成【新viewGraoup】.LayoutParams
如果没有使用LayoutParams,移动xml布局后报这个错,可能是之前编译生成的.class文件与新的java内容冲突,
点击项目->clean。如果不是自动编译的,那就要在手动编译。
0 0
- TextView can not be cast to ViewGroup
- ClassCastException: android.widget.ImageView can not be cast to android.view.ViewGroup
- java.lang.Integer can not be cast to java.lang.Long
- android.view.ViewStub cannot be cast to android.view.ViewGroup
- .ClassCastException: .LinearLayout cannot be cast to android.widget.TextView
- java.lang.ClassCastException: android.view.ViewGroup$LayoutParams cannot be cast to android.view.ViewGroup$MarginLayoutParams
- can not cast to android.support.v7.widget.ShareActionProvider
- EditText cannot cast to ViewGroup
- cannot be cast to
- java.lang.ClassCastException: android.view.ViewGroup$LayoutParams cannot be cast to android.widget.L
- android.view.ViewGroup$LayoutParams cannot be cast to android.widget.TableRow$LayoutParams
- android.view.ViewGroup$LayoutParams cannot be cast to android.widget.RelativeLayout$LayoutParams
- java.lang.ClassCastException: android.view.ViewGroup$LayoutParams cannot be cast to android.widget.
- java.lang.ClassCastException: android.view.ViewGroup$LayoutParams cannot be cast to android.widget.R
- ViewGroup$LayoutParams cannot be cast to android.widget.RelativeLayout$LayoutParams错误提示
- 异常:java.lang.ClassCastException: android.view.ViewGroup$LayoutParams cannot be cast to android.view.
- java.lang.ClassCastException: android.view.ViewGroup$LayoutParams cannot be cast to android.widget.
- 解决 android.view.ViewGroup$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
- PropertyValuesHolder的使用
- C++第四次作业
- 用两个栈实现队列
- HDU 5213 (莫队算法)
- 作业-4
- TextView can not be cast to ViewGroup
- 数据结构之链表学习笔记
- C++上机实验4-求1000以内所有偶数的和
- 第12章 UDP
- Shell:脚本调试
- 我的第一篇博客
- 百度地图离线开发
- rocketmq cluster下concurrently重试机制实现
- 241. Different Ways to Add Parentheses