CWAC的EndlessAdapter中的自定义ListView项

时间:2013-10-15 09:22:46

标签: android listview endlessadapter

我正在使用CWAC的Endlessadapter。默认情况下,它使用默认的ListView只有一个TextView。我想在适配器中使用getView方法以我喜欢的方式设置我的项目,如:

 @Override
    public View getView(final int position, View convertView, final ViewGroup parent) {


      viewHolder cell = null;
//      ImageLoader imageLoader = ImageLoader.getInstance();

        if (convertView == null) {

            cell = new viewHolder();

            convertView = inflater.inflate(R.layout.row,
                    parent, false);


            cell.image = (ImageView) convertView
                    .findViewById(R.id.image_video);

            cell.title = (TextView) convertView
                    .findViewById(R.id.title_video);

            cell.user = (TextView) convertView
                    .findViewById(R.id.user_video);


            convertView.setTag(cell);
        } else {
            cell = (viewHolder) convertView.getTag();
        }



        imageLoader.displayImage(video.mostviewedvideos.get(position).small_poster, cell.image);
        cell.title.setText(video.categoryvideos.get(position).title); 

        cell.user.setText(video.categoryvideos.get(position).username); 







        return convertView;

    }

    static class viewHolder {

        TextView title;
        TextView user;
        ImageView image;
    }

当我在getView()中添加EndlessAdapter时,getPendingView()不再有效。只是想知道我怎样才能做到这一点。

1 个答案:

答案 0 :(得分:0)

好的我回答了我自己的问题。我们所需要的只是超越CustomAdapter中的EndlessAdapter

public EndlessAdapter(Context mContext) {
    super(new CustomAdapter(mContext));
...
}