android 在代码中动态的变更wight和height注意事项 Caused by: java.lang.ClassCastException:android.widget.LinearLayou
来源:互联网 发布:淘宝直播蜜蜡是真的吗 编辑:程序博客网 时间:2024/06/05 19:38
- <LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content">
- <FrameLayout
- android:id="@+id/FrameLayout01"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
- </LinearLayout>
- 若想在代码中动态改变FrameLayout的大小,应该这样写:
- FrameLayout frameLayout=(FrameLayout) convertView.findViewById(R.id.FrameLayout01);
- //注意这里是通过父类获取 new LinearLayout.LayoutParams,而使用时是使用在FrameLayout上
- LinearLayout.LayoutParams ff=new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, height);
- frameLayout.setLayoutParams(ff);
如果不通过上面的方式设置的话,会出现
Caused by: java.lang.ClassCastException:android.widget.LinearLayout$LayoutParams
0 0
- android 在代码中动态的变更wight和height注意事项 Caused by: java.lang.ClassCastException:android.widget.LinearLayou
- 代码改布局的高度等Caused by: java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams
- Caused by: java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams
- Caused by: java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams
- Caused by: java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams
- Caused by: java.lang.ClassCastException: android.widget.LinearLayout
- 转 Caused by: java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams
- Caused by: java.lang.ClassCastException: android.widget.TextView修复
- ERROR/AndroidRuntime: Caused by: java.lang.ClassCastException: android.widget.button
- Caused by: java.lang.ClassCastException: android.widget.TextView修复
- Caused by: java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams
- Caused by: java.lang.ClassCastException: android.widget.TextView修复
- Caused by: java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams 错误
- 莫明的Caused by: java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams
- Caused by: java.lang.ClassCastException: android.widget.TextView cannot be cast to android.widget.Bu
- 【Android笔记-异常-2】Caused by: java.lang.ClassCastException: android.support.v7.widget.AppCompatButton c
- E/AndroidRuntime(30895): Caused by: java.lang.ClassCastException: android.widget.ImageButton
- 错误:E/AndroidRuntime(6539): Caused by: java.lang.ClassCastException: android.widget.
- 第198天
- ADO.NET读取数据库
- 一段程序的人生 第6章:消失
- Python简明教程
- Application Checker 远程输入ip:8889 ,显示403 Forbidden错误。
- android 在代码中动态的变更wight和height注意事项 Caused by: java.lang.ClassCastException:android.widget.LinearLayou
- 设计模式17——Observer设计模式
- 分享下一个削足适履项目开发经历
- HEVC代码跟踪(1)
- 注册页面后台代码-当需跨表插入数据
- USB总线协议概述
- Linux 可靠文件系统(概述)
- iMatrix平台中组织结构标准树(popZtree(zTreeSetting))用法
- 检测压缩包,解压压缩包,删除压缩包,文件的备份和覆盖