WEB开发网
开发学院手机开发Android 开发 android ListView详解 阅读

android ListView详解

 2010-08-23 01:15:00 来源:WEB开发网   
核心提示:059 }060 })061 .show();062063 }064065066067 public final class ViewHolder{068 public ImageView img;069 public TextView title;070 public TextView info;071 public

059 }

060 })

061 .show();

062

063 }

064

065

066

067 public final class ViewHolder{

068 public ImageView img;

069 public TextView title;

070 public TextView info;

071 public Button viewBtn;

072 }

073

074

075 public class MyAdapter extends BaseAdapter{

076

077 private LayoutInflater mInflater;

078

079

080 public MyAdapter(Context context){

081 this.mInflater = LayoutInflater.from(context);

082 }

083 @Override

084 public int getCount() {

085 // TODO Auto-generated method stub

086 return mData.size();

087 }

088

089 @Override

090 public Object getItem(int arg0) {

091 // TODO Auto-generated method stub

092 return null;

093 }

094

095 @Override

096 public long getItemId(int arg0) {

097 // TODO Auto-generated method stub

098 return 0;

099 }

100

101 @Override

102 public View getView(int position, View convertView, ViewGroup parent) {

103

104 ViewHolder holder = null;

105 if (convertView == null) {

106

107 holder=new ViewHolder();

108

109 convertView = mInflater.inflate(R.layout.vlist2, null);

110 holder.img = (ImageView)convertView.findViewById(R.id.img);

111 holder.title = (TextView)convertView.findViewById(R.id.title);

112 holder.info = (TextView)convertView.findViewById(R.id.info);

113 holder.viewBtn = (Button)convertView.findViewById(R.id.view_btn);

114 convertView.setTag(holder);

115

116 }else {

上一页  2 3 4 5 6 7 8  下一页

Tags:android ListView 详解

编辑录入:coldstar [复制链接] [打 印]
赞助商链接