码迷,mamicode.com
首页 > 移动开发 > 详细

MyApp

时间:2017-12-03 20:50:59      阅读:422      评论:0      收藏:0      [点我收藏+]

标签:extends   find   ring   tag   base   getview   ima   load   imageview   

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

标签:extends   find   ring   tag   base   getview   ima   load   imageview   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!