Tôi là người mới lập trình Android và thực hiện các bước đầu tiên với Bộ điều hợp (cho một ListView
).ghi đè Adapter.getView
Trọng sự Adapter.getView
Tôi thường thấy những điều như thế này:
public View getView(int position, View convertView, ViewGroup parent) {
View itemView = null;
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) parent.getContext()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
itemView = inflater.inflate(R.layout.table_row, null);
} else {
itemView = convertView;
}
// play with itemView
return itemView;
}
Câu hỏi của tôi là những gì nói chống lại điều này:
public View getView(int position, View convertView, ViewGroup parent) {
View itemView = super(position, convertView, parent);
// play with itemView
return itemView;
}
Điều này dường như làm việc cho tôi, nhưng tôi chắc chắn rằng có một lớn điểm tôi thiếu: D
Cảm ơn bạn đã đọc và xin lỗi vì tiếng anh xấu của tôi ...