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 ...
随机推荐
- Ubuntu install JDK
1.#下载JDK,记住保存的目录 2. sudo mkdir /usr/java 3. sudo tar zxvf jdk-7u75-linux-x64.tar.gz -C /usr/java 4. ...
- Identity Server 4 原理和实战(完结)_Hybrid Flow 实例, Claims, 角色授权和策略授权
4分50 建立客户端 不需要身份认证 客户端叫做HybirdClient 配置IdentityServer服务端,先把客户端添加上 把userClaims添加到token里面 然后运行服务端就可以了 ...
- 面试lua笔试题各种坑
替换字符串"abcdefgh" 中的"abc"为"ddc" local str ="abcdefgh"; b = str ...
- 51nod1010【二分】
打表+二分 #include <bits/stdc++.h> using namespace std; typedef long long LL; const LL inf=1e18+10 ...
- laravel 安装配置前准备
Laravel 框架使用 Composer 来管理其依赖性.所以,在你使用 Laravel 之前,你必须在你电脑上是否安装了 Composer.最简单的获取Composer的方式就是百度之,百度关键字 ...
- MongoDb 数据修补笔记
1. 2013.08.21 KS 数据有严重问题, 缺乏数十秒数据, serialNumber 乱序
- bzoj5093:图的价值(第二类斯特林数+NTT)
传送门 首先,题目所求为\[n\times 2^{C_{n-1}^2}\sum_{i=0}^{n-1}C_{n-1}^ii^k\] 即对于每个点\(i\),枚举它的度数,然后计算方案.因为有\(n\) ...
- Node.js 使用Stream的pipe(管道)方法实现文件复制
Stream模块有一个pipe方法,可以将两个流串起来,实现所有的数据自动从Readable流进入Writable流 "use strict"; const fs = requir ...
- 在虚拟机中设置NAT模式实现主机和虚拟机的通信
1.打开虚拟机,对几个节点进行网络连接的设置.虚拟机设置/网络连接,选择“NAT模式” 2.编辑—>虚拟网络编辑器来查看NAT模式中所用到的网段. 从上图可以看出,NAT中的子网IP是192.1 ...
- bzoj2502清理雪道
传送门 好题啊,由于每个点既可以进,也可以出,就可以新建一个源点和汇点,对于每个点都连边,然后就是最小流板子了. 代码: #include<cstdio> #include<iost ...