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 ...
随机推荐
- 解决warning: LF will be replaced by CRLF in **(filename)
使用Windows的Git使用 git add 时出现warning: LF will be replaced by CRLF in **(filename) 原因: CRLF -- Carriage ...
- 从使用os.system)在python命令(重定向标准输入输出
从使用os.system)在python命令(重定向标准输入输出 python 标准输出stdout stdio os.system通常我可以通过改变sys.stdout的值在python更改标准输出 ...
- Eigen::aligned_allocator
http://blog.csdn.net/rs_huangzs/article/details/50574141
- jquery 点击某一行,得到这一行的每个列的数据
<html><head> <title>test</title> <script src="../Scripts/jquery-1.8. ...
- Android-毛笔的探索与开发
前言 这篇文章主要是关于移动端毛笔的开发,在平板上有着书写毛笔字贴的效果. 介绍关于毛笔的算法思路. 项目github地址 算法思路分析 曲线拟合算法 利用曲线拟合算法增加虚拟的点,使得笔迹更加光滑 ...
- Git之设置对文件名大小写敏感
关键命令 git config core.ignorecase false
- Python Matplotlib 中对于 bar 显示时间的问题
参考: 官方教程: http://matplotlib.org/1.3.1/users/recipes.html http://stackoverflow.com/questions/13515471 ...
- [Swift]快速反向平方根 | Fast inverse square root
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★➤微信公众号:山青咏芝(shanqingyongzhi)➤博客园地址:山青咏芝(https://www.cnblogs. ...
- java模拟进程调度之模拟抢占试多级轮转调度(附带可视化解决方案)
1.简介一下多级轮转调度 多级轮转调度是一种提高调度效率的解决方案,简单讲就是讲要执行的程分成几个优先级的列队即例如三个,第一个列队分10个时间片,第二个列队分配1000个时间片,第三个列队表示100 ...
- mysql 配置大小写敏感后不能重启
[问题现象] 在mysql的配置文件my.cnf配置lower_case_table_names=1后不能重启mysql,提示mysql.serviceJob for mysql.service fa ...