我在SOF阅读了许多关于CursorAdaptor的文章 - newView/getView/bindView。Android CursorAdapter getView/newView应该是膨胀一样的东西吗?
如果我为自动完成文本字段创建自定义适配器,我必须实现newView()和bindView()。
但有人说,实现getView()可以提高滚动时的速度。
所以,问题是,
如果上NewView的(),已膨胀的图。
public View newView(Context context, Cursor cursor, ViewGroup parent) {
final LayoutInflater inflater = LayoutInflater.from(context);
// =Single Line=
final TextView view = (TextView) inflater.inflate(android.R.layout.simple_list_item_1, parent, false);
String item = createItem(cursor);
view.setText(item);
return view;
}
所以在getView()上,我做了同样的事情吗?
谁是“某人”?资源? – njzk2
'view.setText(item);'应该在bindView中,而不是newView(同样,看代码中的getCursorAdapter中的getView会调用newView(如果需要)和bindView之后) – njzk2