首页 > 移动平台 > 详细

MyApp

时间:2017-12-03 20:21:24      阅读:266      评论:0      收藏:0      [点我收藏+]
package com.example.week;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.nostra13.universalimageloader.core.ImageLoader;

import java.util.List;

/**
* Created by 生哥 on 2017/12/2.
*/

public class My extends BaseAdapter{
private List<News.NewslistBean> list;
private Context context;

public My(List<News.NewslistBean> list, Context context) {
this.list = list;
this.context = context;
}

@Override
public int getCount() {
return list.size();
}

@Override
public Object getItem(int position) {
return list.get(position);
}

@Override
public long getItemId(int position) {
return position;
}

@Override
public View getView(int position, View v, ViewGroup parent) {
VH vh;
if (v == null){
vh = new VH();
v = View.inflate(context, R.layout.list,null);
vh.tv1 = v.findViewById(R.id.List_Title);
vh.tv2 = v.findViewById(R.id.List_riqi);
vh.iv = v.findViewById(R.id.List_tu);
v.setTag(vh);
}else {
vh = (VH) v.getTag();
}
vh.tv1.setText(list.get(position).getTitle());
vh.tv2.setText(list.get(position).getCtime());
String pic_url = list.get(position).getPicUrl();
ImageLoader.getInstance().displayImage(pic_url,vh.iv);
return v;
}
class VH{
TextView tv1,tv2;
ImageView iv;
}
}

MyApp

原文:http://www.cnblogs.com/wangwensheng/p/7966990.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!