ListView 自定义item布局 android.widget.LinearLayout$LayoutParams
来源:互联网 发布:中世纪2优化九国家简介 编辑:程序博客网 时间:2024/05/16 13:04
如果对外层的 Layout设置属性的话,
lnLayout.setLayoutParams(new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT, android.R.attr.listPreferredItemHeight));
则会报错。。。如上的错误信息,,具体的如下
解决办法就是取消对其中的设置
看到http://hi.baidu.com/ljlkings/blog/item/86ed2401029b4efd08fa9303.html
受到了一点启发 :
These supply parameters to the parent of this view specifying how it should be arranged. There are many subclasses of ViewGroup.LayoutParams, and these correspond to the different subclasses of ViewGroup that are responsible for arranging their children.
So basically, if you are adding a view to another, you MUST set the LayoutParams of the view to the LayoutParams type that the parent uses, or you will get a runtime error.
就是說你要設置此layoutparameters須對父對象佈局設定,最上層的layout不需設定此項。
- ListView 自定义item布局 android.widget.LinearLayout$LayoutParams
- ListView 自定义item布局 android.widget.LinearLayout$LayoutParams
- Android学习——自定义布局LinearLayout,参数LayoutParams
- java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams
- LinearLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
- 代码改布局的高度等Caused by: java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams
- android.widget.FrameLayout$LayoutParams cannot be cast to android.widget.LinearLayout$LayoutParams
- android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.AbsListView$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$LayoutParams
- Caused by: java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams
- Caused by: java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams 错误
- Android异常:RelativeLayout$LayoutParams cannot be cast to android.widget.LinearLayout$LayoutParams
- android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.RelativeLayout$LayoutPara
- android.widget.RelativeLayout$LayoutParams cannot be cast to android.widget.LinearLayout$LayoutParam
- ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.AbsLis
- 明星软件工程师的10种特质
- 弹出窗口总结
- asp.net 关闭网页代码
- volatile
- mysql优化方案
- ListView 自定义item布局 android.widget.LinearLayout$LayoutParams
- 多国语言字库原理
- 数据绑定页面判断显示长度其余用点代替
- 实验之余,我是如何淘金的?[小木虫]
- Doxygen 配置学习笔记
- 几则故事
- Oracle行列转换
- shell中数组的使用
- oracle角色权限,系统权限和对象权限