你可以告诉我在这个例子中Character
将如何改变:
List
我想知道HashSet
& convertView
& @Override
public View getView(int position, View convertView, ViewGroup parent) {
// If we weren't given a view, inflate one
if (convertView == null) {
convertView = getActivity().getLayoutInflater().inflate(R.layout.list_item_crime, null);
}
// Configure the view for this Crime
Crime c = getItem(position);
TextView titleTextView =
(TextView)convertView.findViewById(R.id.crime_list_item_titleTextView);
titleTextView.setText(c.getTitle());
TextView dateTextView =
(TextView)convertView.findViewById(R.id.crime_list_item_dateTextView);
dateTextView.setText(c.getDate().toString());
CheckBox solvedCheckBox =
(CheckBox)convertView.findViewById(R.id.crime_list_item_solvedCheckBox);
solvedCheckBox.setChecked(c.isSolved());
return convertView;
}
影响convertView ???
或者在方法结束时返回的titleTextView
与dataTextView
和solvedCheckBox
& convertView
& convertView = getActivity().getLayoutInflater().inflate(R.layout.list_item_crime, null);
在titleTextView
???
答案 0 :(得分:1)
if (convertView == null) {
convertView = getActivity().getLayoutInflater().inflate(R.layout.list_item_crime, null);
}
这是convertView的初始化,你只需要第一次这样做,然后第二次不需要它和titleTextView& dataTextView& solveCheckBox不会影响convertView