社区
Android
帖子详情
安卓开发出现了这个错误:android.widget.imageview cannot be cast to android.widget.LinearLayo
zzg93
2016-07-12 10:09:55
安卓开发出现了这个错误:android.widget.imageview cannot be cast to android.widget.LinearLayout
怎么造成的?怎么解决?
...全文
660
1
打赏
收藏
安卓开发出现了这个错误:android.widget.imageview cannot be cast to android.widget.LinearLayo
安卓开发出现了这个错误:android.widget.imageview cannot be cast to android.widget.LinearLayout 怎么造成的?怎么解决?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
1 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
dusmit
2016-07-12
打赏
举报
回复
不能把imgview装换为linerlayout,控件和id要对应起来
Class
Cas
tException:
android
.
widget
.
ImageView
cannot be
cas
t to
android
.
widget
.Relative
Layo
ut
今天写代码的时候碰到了一个莫名其妙的问题,半天找不到问题在哪。异常如下: Class
Cas
tException:
android
.
widget
.
ImageView
cannot be
cas
t to
android
.
widget
.Relative
Layo
ut,一看到这个异常,肯定以为是没有做类型转换,或者转换错了,但我检查了一下代码发现,这两种情况都没有
出现
,代码是没有问题的! 那到底为什么还是报这个异常呢? 既然排除了代码的问题,那就只能是编译器可能出毛病 了,网上给的建议是手动编译一下试试。 于是
java.lang.Class
Cas
tException:
android
.
widget
.
ImageView
cannot be
cas
t to
android
.
widget
.TextView解决办法
错误
提示: java.lang.Class
Cas
tException:
android
.
widget
.
ImageView
cannot be
cas
t to
android
.
widget
.TextView
出现
原因: xml中更改布局,替换了父viewGroup,比如说从当前
Linear
Layo
ut移动到另一个Relative
Layo
ut 解决办法:检查一下之前有没有使用
Layo
utParams
java.lang.Class
Cas
tException~
android
.
widget
.
ImageView
cannot be
cas
t to
android
.
widget
.Button
当修改布局XML文件。。或者java的时候。。感觉应该没什么不对的,就那么
出现
了
错误
。。。
错误
提示有很多种。。
错误
提示: java.lang.Class
Cas
tException:
android
.
widget
.
ImageView
cannot be
cas
t to
android
...
Class
Cas
tException:
android
.
widget
.
ImageView
cannot be
cas
t to
android
.
widget
.TextView
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.facialfeatures/com.example.facialfeatures.MainActivity}: java.lang.Class
Cas
tException:
android
.
widget
.
ImageView
cannot be
Android
: java.lang.Class
Cas
tException:
android
.
widget
.
imageView
cannot be
cas
t to
android
.
widget
.tex
遇到问题:
Android
: java.lang.Class
Cas
tException:
android
.
widget
.
imageView
cannot be
cas
t to
android
.
widget
.textView 解决方案: Clean 你的项目.修改一个xml文件,然后保存删除 R 文件. (build project 之后会自动生成).
Android
80,492
社区成员
91,379
社区内容
发帖
与我相关
我的任务
Android
移动平台 Android
复制链接
扫一扫
分享
社区描述
移动平台 Android
android
android-studio
androidx
技术论坛(原bbs)
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章