java.lang.ClassCastException: android.widget.ImageButton异常处理
在调程序时总是出现异常关闭的现象,log显示:
03-26 07:58:09.528: E/AndroidRuntime(398): Caused by: java.lang.ClassCastException: android.widget.ImageButton
XML中:

JAVA文件中:

解决方法:
把两个控件类型改成一致的就可以了。
java.lang.ClassCastException: android.widget.ImageButton异常处理的更多相关文章
- java.lang.ClassCastException: android.widget.RelativeLayout cannot be cast to android.widget.TextView
最近在学习drawerLayout时,遇到这个bug.如下示: java.lang.ClassCastException: android.widget.RelativeLayout cannot b ...
- java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.EditText
Caused by: Java.lang.ClassCastException: Android.widget.TextView cannot be cast to android.widget.Ed ...
- 安卓出现错误: java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.EditText
Caused by: Java.lang.ClassCastException: Android.widget.TextView cannot be cast to android.widget.Ed ...
- 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 ...
- java.lang.ClassCastException:android.widget.Button cannot be cast to android.widget.ImageView
今天遇到一个错误也不知道怎么回事,上网搜了一下: 出现的问题是:java.lang.ClassCastException:android.widget.Button cannot be cast to ...
- java.lang.ClassCastException android.widget.RelativeLayout LayoutParams 异常
1.在xml布局文件如下所示: <RelativeLayout android:layout_width="match_parent" android:layout_heig ...
- Exception: java.lang.ClassCastException: android.widget.RelativeLayout$LayoutParams
RelativeLayout title_bg = (RelativeLayout)FTU_Bluetooth.this.findViewById(R.id.titlebar); LinearLayo ...
- Caused by: java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams
最近,在android中用代码动态改变某种布局(组件)的高度时,会遇到如题所示的类转换异常.上网查了一下,如下所示: These supply parameters to the parent of ...
- Android: java.lang.ClassCastException: android.widget.imageView cannot be cast to android.widget.textView异常解决
有时在修改xml文件时,全报这种错误,这个应该是缓存没得到及时更新导致的,可以通过以下方法解决: Eclipse tends to mess up your resources every now a ...
随机推荐
- C++ 局部静态变量,全局变量,全局静态变量,局部变量的区别和联系
C++变量根据定义位置的不同,具有不同的作用域,作用域可分为6种:全局作用域,局部作用域,语句作用域,类作用域,命名作用域和文件作用域. 从作用域看: 全局变量具有全局作用域.全局变量只需在一个源文件 ...
- AngularJs编辑器
问题:在使用过程中遇到的问题就是:angularJS绑定不上值.后来找到一种可以用的方式. html页 <div class="all"> <script typ ...
- 修复 Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:build-helper-maven-plugin:1.8:add-source (execution: add-source, phase: generate-sources)
在maven项目中使用add-source时,pom.xml报如下错误: Plugin execution not covered by lifecycle configuration: org.co ...
- 响应式布局(Responsive Layout)/流式布局(Fluid Layout)/自适应布局(Adaptive)
1.使用媒体查询来适应不同视口的固定宽度设计,例如bootstrap的container类. 2.将固定像素布局转换成灵活的百分比布局,才能让页面元素根据视口大小在一个又一个媒体查询间伸缩修正样式. ...
- 常用的20个强大的 Sublime Text 插件
作为一个开发者你不可能没听说过 Sublime Text.不过你没听说过也没关系,下面让你明白. Sublime Text是一款非常精巧的文本编辑器,适合编写代码.做笔记.写文章.它用户界面十分整洁, ...
- 拦截asp.net输出流做处理
本文标题是指对已经生成了HTML的页面做一些输出到客户端之前的处理. 方法的原理是:把Response的输出重定向到自定义的容器内,也就是我们的StringBuilder对象里,在HTML所有的向页面 ...
- Codeforces Round #420 (Div. 2) A-E
本来打算划划水洗洗睡了,突然听到这次的主人公是冈部伦太郎 石头门(<steins;gate>)主题的比赛,岂有不打之理! 石头门真的很棒啊!人设也好剧情也赞曲子也特别好听. 推荐http: ...
- [POJ2356]Find a multiple 题解(鸽巢原理)
[POJ2356]Find a multiple Description -The input contains N natural (i.e. positive integer) numbers ( ...
- 项目记录 -- config2html 理解
html 代码: <table width=1280 border=0 cellspacing=1 cellpadding=1> <tr id=tblhdr> <td&g ...
- php文件上传——php经典实例
php文件上传——php经典实例 表单页 <html> <head> <title>文件上传</title> <meta charset='ut ...