• 大小: 1.42M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-06-23
  • 语言: Java
  • 标签: listview  适配器  

资源简介

package com.great.baseadapter;

import java.util.ArrayList;

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

public class MyBaseAdapter extends BaseAdapter {

private Context context;
private ArrayList<MyData> list;
private MyData data;
private ViewHolder holder;

public MyBaseAdapter(Context context, ArrayList<MyData> list) {
super();
this.context = context;
this.list = list;
}
//返回条目数
@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 convertView, ViewGroup parent) {
TextView tv_01 = null,tv_02=null;
//产生View
if(convertView==null)
{
convertView = LayoutInflater.from(context).inflate(R.layout.actvity_item, null);
holder = new ViewHolder();
holder.tv_01 = (TextView) convertView.findViewById(R.id.tv_01);
holder.tv_02 = (TextView) convertView.findViewById(R.id.tv_02);

//tv_01.setText(list.get(position).getText1());
//tv_02.setText(list.get(position).getText2());
convertView.setTag(holder);

}
else
{
holder = (ViewHolder) convertView.getTag();
// tv_01 = (TextView) convertView.findViewById(R.id.tv_01);
// tv_02 = (TextView) convertView.findViewById(R.id.tv_02);
//
// tv_01.setText(list.get(position).getText1());
// tv_02.setText(list.get(position).getText2());
}


holder.tv_01.setText(list.get(position).getText1());
holder.tv_02.setText(list.get(position).getText2());

return convertView;
}

private class ViewHolder
{
private TextView tv_01;
private TextView tv_02;
}

}

资源截图

代码片段和文件信息

/** Automatically generated file. DO NOT MODIFY */
package com.great.baseadapter;

public final class BuildConfig {
    public final static boolean DEBUG = true;
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-10-06 22:01  baseAdapter\
     文件         475  2015-09-30 11:55  baseAdapter\.classpath
     文件         847  2015-09-30 11:55  baseAdapter\.project
     文件         884  2015-09-30 11:55  baseAdapter\AndroidManifest.xml
     目录           0  2015-10-25 12:32  baseAdapter\assets\
     目录           0  2015-10-06 22:01  baseAdapter\bin\
     文件         884  2015-09-30 11:55  baseAdapter\bin\AndroidManifest.xml
     文件      282227  2015-09-30 11:55  baseAdapter\bin\baseAdapter.apk
     目录           0  2015-10-06 22:01  baseAdapter\bin\classes\
     目录           0  2015-10-06 22:01  baseAdapter\bin\classes\com\
     目录           0  2015-10-06 22:01  baseAdapter\bin\classes\com\great\
     目录           0  2015-10-06 22:01  baseAdapter\bin\classes\com\great\baseadapter\
     文件         351  2015-09-30 11:55  baseAdapter\bin\classes\com\great\baseadapter\BuildConfig.class
     文件        1983  2015-09-30 11:55  baseAdapter\bin\classes\com\great\baseadapter\MainActivity.class
     文件        1170  2015-09-30 11:55  baseAdapter\bin\classes\com\great\baseadapter\MybaseAdapter$ViewHolder.class
     文件        2691  2015-09-30 11:55  baseAdapter\bin\classes\com\great\baseadapter\MybaseAdapter.class
     文件         809  2015-09-30 11:55  baseAdapter\bin\classes\com\great\baseadapter\MyData.class
     文件         349  2015-09-30 11:55  baseAdapter\bin\classes\com\great\baseadapter\R$attr.class
     文件         470  2015-09-30 11:55  baseAdapter\bin\classes\com\great\baseadapter\R$dimen.class
     文件         416  2015-09-30 11:55  baseAdapter\bin\classes\com\great\baseadapter\R$drawable.class
     文件         548  2015-09-30 11:55  baseAdapter\bin\classes\com\great\baseadapter\R$id.class
     文件         448  2015-09-30 11:55  baseAdapter\bin\classes\com\great\baseadapter\R$layout.class
     文件         397  2015-09-30 11:55  baseAdapter\bin\classes\com\great\baseadapter\R$menu.class
     文件         481  2015-09-30 11:55  baseAdapter\bin\classes\com\great\baseadapter\R$string.class
     文件         440  2015-09-30 11:55  baseAdapter\bin\classes\com\great\baseadapter\R$style.class
     文件         703  2015-09-30 11:55  baseAdapter\bin\classes\com\great\baseadapter\R.class
     文件      910700  2015-09-30 11:55  baseAdapter\bin\classes.dex
     目录           0  2015-10-06 22:01  baseAdapter\bin\dexedLibs\
     文件      234431  2015-09-30 11:55  baseAdapter\bin\dexedLibs\android-support-v4-109ba248f9bccc90de761774a40c42dc.jar
     文件         943  2015-09-30 11:55  baseAdapter\bin\dexedLibs\annotations-92533de0a5c6b20767423aa77737f36e.jar
     目录           0  2015-10-06 22:01  baseAdapter\bin\res\
............此处省略51个文件信息

评论

共有 条评论