Android ListView标头
我有ListView上面有某种事件。事件是按天排序的,我希望每天都有带有日期的标头,然后事件在下面侦听。 这是我填充该列表的方式: ArrayList<TwoText> crs = new ArrayList<TwoText>(); crs.add(new TwoText("This will be header", event.getDate())); for (Event event : events) { crs.add(new TwoText(event.getStartString() + "-" + event.getEndString(), event.getSubject())); } arrayAdapter = new TwoTextArrayAdapter(this, R.layout.my_list_item, crs); lv1.setAdapter(arrayAdapter); 这是我的类TwoText的外观: public class TwoText { public String classID; public String state; public TwoText(String classID, String state) …