更新时间:2023-10-15 08:11:04
我理解这一点。你应该增加类似在模型中的头
多个属性。
I understood it a little bit. You should add more attribute like header
in your model.
如果你的头
= 真正,并在适配器
类,则有膨胀的布局 header.xml
。否则,如果头
= 假,那么你应该夸大你的XML文件,即(的TextView
,的ImageView
)为正常。
If your header
= true and in your adapter
class, then you have to inflate the layout header.xml
. Otherwise, if header
= false, then you should inflate your xml file i.e. (TextView
,ImageView
) as normal.
下面分隔符
在我的code是一样的头
Here separator
in my code is the same as your header
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
final recordModel model = records.get(position);
ViewHolder holder;
convertView = null;
holder = new ViewHolder();
if(records.get(position).getSeparator()==0){
convertView = inflater.inflate(R.layout.record_row, null);
convertView.setTag(holder);
holder.imageView = (ImageView) convertView
.findViewById(R.id.iconCallType);
holder.title = (TextView) convertView.findViewById(R.id.title);
holder.note = (TextView) convertView.findViewById(R.id.note);
holder.checkBox = (CheckBox) convertView.findViewById(R.id.check_box);
..........................
}else if(records.get(position).getSeparator()==1){
convertView = inflater.inflate(R.layout.separator, null);
convertView.setTag(holder);
holder.title = (TextView) convertView.findViewById(R.id.textSeparator);
holder.title.setText(records.get(position).getCallDay());
}
return convertView;
}