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 ...
随机推荐
- CF 809D Hitchhiking in the Baltic States——splay+dp
题目:http://codeforces.com/contest/809/problem/D 如果值是固定的,新加入一个值,可以让第一个值大于它的那个长度的值等于它. 如今值是一段区间,就对区间内的d ...
- Azure SQL Database (27) 创建Table Partition
<Windows Azure Platform 系列文章目录> 昨天客户正好提到这个问题,现在记录一下. 我们在使用传统的SQL Server,会使用Table Partition,这个功 ...
- android 自动生成jni C语言头文件
1. 在类里面申明 public native xxx(); 函数接口2. 在安卓工程src目录下 使用命令 javah 包名.类名 生成该类所申明的c语言接口
- Word2013 在一个页面双列显示
1. 效果图 2. 实现方法 (1) 进入页面布局 (2) 选中要整理的字,选中Columns,然后选择Two
- easyui更改messager的OkCancel按钮为(中文)确定取消
jquery-easyui默认情况下,消息框的按钮文字是英文的OK Cancel,但可以通过提供的方法进行修改,如: $.extend($.messager.defaults,{ ok:" ...
- dead code 死代码 无作用的代码
DatasetVector datasetvector=(DatasetVector)dataset; if (datasetvector == null) ...
- 洛谷 - P3768 - 简单的数学题 - 欧拉函数 - 莫比乌斯反演
https://www.luogu.org/problemnew/show/P3768 \(F(n)=\sum\limits_{i=1}^{n}\sum\limits_{j=1}^{n}ijgcd(i ...
- Linux下配置 禅道 (项目管理系统)
1.官网下载源码 2.解析一个新的子域名,然后到linux服务器上新建一个站点 3.将下载的文件上传至linux服务器(新建站点的时候已经在 /home/wwwroot/ 里建好了域名对应的文件夹,将 ...
- rsync 同步的艺术
rsync是类unix系统下的数据镜像备份工具,可以提供快速的增量文件传输. rsync 也可用于本机传输,如: # rsync -v mysql--linux-glibc2.-x86_64.tar. ...
- js对象 数组Array详解 (参照MDN官网:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)
一:数组的创建方式: 1.采用直接量创建 var arr = [];//创建一个空数组 var arr2 = [1,2,3];//创建一个有三个元素的数组 2.采用构造函数创建 a.var arr1 ...