您的位置:首页 > 移动开发 > Android开发

java.lang.ClassCastException: android.widget.RelativeLayout$LayoutParams cannot be cast to android.w

2015-03-31 14:12 555 查看
使用baseadapter出现


java.lang.ClassCastException: android.widget.RelativeLayout$LayoutParams
cannot be cast to android.widget.AbsListView$LayoutParams

错误,一般是你自己的实现baseadapter的方法中

public View getView(int arg0, View arg1, ViewGroup arg2) {
// TODO Auto-generated method stub
RelativeLayout view7 = (RelativeLayout)
LayoutInflater
.from(MainActivity.this).inflate(
R.layout.second, null);

这是在你的second布局文件中与这不对应 ,如果你布局文件中用的linearlayout,然后这边也得用linearlayout,如果用的是relativelayout,这边也用relativelayout。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐