android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams

郑理
2023-12-01

在适配器中出现这种问题时,首先查看是不是普通定义控件的类型转换出现问题,然后检查返回值是否是定义的那个返回值

if (convertView == null) {
     convertView = LayoutInflater.from(getActivity()).inflate(R.layout.common_item_hlistview, null);
     holder = new ViewHolder();
     //第一次初始化的时候装进来
    holder.sc = (CHScrollView2) convertView.findViewById(R.id.item_chscroll_scroll);
     holder.tv0 = (TextView) convertView.findViewById(R.id.item_titlev);
     holder.tv1 = (TextView) convertView.findViewById(R.id.item_datav1);
     holder.tv2 = (TextView) convertView.findViewById(R.id.item_datav2);
     holder.tv3 = (TextView) convertView.findViewById(R.id.item_datav3);
     holder.tv4 = (TextView) convertView.findViewById(R.id.item_datav4);
     holder.tv5 = (TextView) convertView.findViewById(R.id.item_datav5);
     holder.tv6 = (TextView) convertView.findViewById(R.id.item_datav6);
     addHViews(holder.sc);
     convertView.setTag(holder);
 } else {
     holder = (ViewHolder) convertView.getTag();
 }

 fundRankBean = fundRankBeanList.get(position);
holder.tv0.setText(fundRankBean.getName());
 holder.tv1.setText(fundRankBean.getMarketCode());
 holder.tv2.setText(fundRankBean.getIncome());
 holder.tv3.setText(fundRankBean.getTiming());
 holder.tv4.setText(fundRankBean.getDisperse());
 holder.tv5.setText(fundRankBean.getScore());
 holder.tv6.setText(fundRankBean.getEvaluate());
 holder.sc.AddOnScrollChangedListener(new CHScrollView2.OnScrollChangedListener() {
     @Override
     public void onScrollChanged(int l, int t) {
         onScrollAll(l, t);
     }
 });
 return convertView;

 类似资料:

相关阅读

相关文章

相关问答