第一:重用convertView,
public ViewgetView(int position,ViewconvertView,ViewGroup parent){
if(convertView==null){
convertVie=layoutInflate.form().inflate();
}
TextView
}
第二:内部类classViewHolder,来标示view中的一些 控件,
...
class ViewHolder{
TextView tv_name,tv_phone;
第三:
public VIew getVIew(int position,VIew convertVIew, View Groupparent){
View view=convertView;
ViewHolder holder;
if(view==null){
View=LayoutInflate.from(context).inflate(R.layout.section_list_item1,null);}
holder=new ViewHolder();
holdre.tv_ame=()view.findViewById(R.id.contact_cintactinfoitem_tv_name);
view.setTag(holder);
}
else{holder=()view.getTag();}
时间: 2024-12-31 03:53:26