java.lang.ClassCastException android.widget.RelativeLayout LayoutParams 异常
1、在xml布局文件如下所示:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/darker_gray"
android:paddingBottom="5dp"
android:paddingTop="5dp" > <View
android:id="@+id/slide_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/slide_background" /> <LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" > <RelativeLayout
android:id="@+id/rl_conversation"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
2、在java.class文件中获取控件mSlideView的布局参数getLayoutParams, 运行过程中出现
java.lang.ClassCastException android.widget.RelativeLayout LayoutParams 异常,经过查找资料,发现引用包错了。
// 得到会话布局的参数,设置给滑块 ( 因为这个view的父布局是 RelativeLayout)
不能引用系统默认引用的包 import android.widget.LinearLayout.LayoutParams;
java.lang.ClassCastException android.widget.RelativeLayout LayoutParams 异常的更多相关文章
- Exception: java.lang.ClassCastException: android.widget.RelativeLayout$LayoutParams
RelativeLayout title_bg = (RelativeLayout)FTU_Bluetooth.this.findViewById(R.id.titlebar); LinearLayo ...
- 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.RelativeLayout cannot be cast to android.widget.TextView
最近在学习drawerLayout时,遇到这个bug.如下示: java.lang.ClassCastException: android.widget.RelativeLayout cannot b ...
- Caused by: java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams
最近,在android中用代码动态改变某种布局(组件)的高度时,会遇到如题所示的类转换异常.上网查了一下,如下所示: These supply parameters to the parent of ...
- 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: main09-09 10:19:59.979: E/AndroidRuntim ...
- 关于java.lang.NoSuchMethodError: android.widget.RelativeLayout.setBackground的解决办法
今天用一个安卓4.0.4版本的手机测试手上的项目,发现logcat弹出这样一个提示“java.lang.NoSuchMethodError: android.widget.RelativeLayout ...
- java.lang.ClassCastException: android.widget.ImageButton异常处理
在调程序时总是出现异常关闭的现象,log显示: 03-26 07:58:09.528: E/AndroidRuntime(398): Caused by: java.lang.ClassCastExc ...
- 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 ...
随机推荐
- 创建cube 维度层次
http://blog.programmingsolution.net/ssas-2008/period-dimension-time-dimension-creation-with-year-mon ...
- MFC绘制直角坐标系
void CMyPicoTestDlg::DrawWave(CDC *pDC,CRect &rectPicture) { CPen newPen; //用于创建新画笔 CPen *pOldPe ...
- 3-C++程序的结构1.2
对象的生存周期 可以分为静态生存周期和动态生存周期 1.静态生存周期 如果对象的生存期与程序的运行期相同,我们称它具有静态生存期.在文件作用域中声明的对象都具有静态生存期的.如果要在函数的块中声明具有 ...
- jquery中innerheight outerHeight()与height()的区别
1. .height() 获取匹配元素集合中的第一个元素的当前计算高度值 或 设置每一个匹配元素的高度值(带一个参数). 注意:1).css('height')和.height()之间的区别是后者返回 ...
- Golang : flag 包简介
在 Golang 程序中有很多种方法来处理命令行参数.简单的情况下可以不使用任何库,直接处理 os.Args:其实 Golang 的标准库提供了 flag 包来处理命令行参数:还有第三方提供的处理命令 ...
- POJ3737【数学】
高中数学题?初中吧///然后注意一下POJ的double输出用%f.......... #include <iostream> #include <stdio.h> #incl ...
- CodeForces 689B【最短路】
题意: 给你一副图,给出的点两两之间的距离是abs(pos1-pos2),然后给你n个数是表示该pos到x的距离是1. 思路: 直接建边,跑spfa就好了.虽然说似乎题意说边很多,其实只要建一下相邻的 ...
- [HNOI2010] 矩阵 matrix
标签:dfs+剪枝. 题解: 这道题看着就像一道dfs题目,没有什么算法可以用来算这个东西,于是想想暴搜. 如果我们确定因为是2*2的子矩阵的和,如果确定了其中三个,那么就可以确定第四个,发现如果确定 ...
- Mybatis分页中遇到的坑2
站在巨人的肩膀上 http://crocutax.com/blog/mybatis-one-to-many-nestes-query-and-page-query Mybatis一对多嵌套查询和 ...
- python 的sorted函数
sorted函数:sorted(iterable,key,reverse) 其中iterable表示可以迭代的对象, key是一个函数,用来选取参与比较的元素,reverse则是用来指定排序是倒序还 ...