我是初学者。我已经尝试了很多,但我不知道我该怎么做:
我有一个ArrayAdapter。这显示了所有项目,if position == 3
它还应该显示一个标签。
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView;
if (position == 3){
rowView = inflater.inflate(R.layout.event_date, parent, false);
// set text of label ...
// now I want to display also the normal item
} else {
rowView = inflater.inflate(R.layout.events_list, parent, false);
// set text of item ...
}
return rowView;
}
它显示标签,但我不知道如果它显示标签,我怎么能显示正常项目。我怎样才能做到这一点?