}
用getView方法来返回视频对象,主要代码如下
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
if (convertView == null) {
convertView = LayoutInflater.from(context).inflate(R.layout.item_mainlv,parent,false);
holder = new ViewHolder(convertView);
convertView.setTag(holder);
}else {
holder = (ViewHolder) convertView.getTag();
}
// 获取指定位置的数据源
VideoBean.ItemListBean.DataBean dataBean = mDatas.get(position).getData();
// 设置发布者的信息
VideoBean.ItemListBean.DataBean.AuthorBean author = dataBean.getAuthor();
holder.nameTv.setText(author.getName());
holder.descTv.setText(author.getDescription());
String iconURL = author.getIcon();
if (!TextUtils.isEmpty(iconURL)) {
Picasso.with(context).load(iconURL).in