简体   繁体   English

bindView如何工作?

[英]How does bindView work?

I have a custom CursorAdapter. 我有一个自定义的CursorAdapter。 I have overridden bindView method as 我已经覆盖了bindView方法为

public void bindView(View view,Context context, Cursor cursor){
       TextView title=(TextView) view.findViewById(R.id.row_title);
       title.setText(cursor.getString(1));
       TextView subTitle=(TextView) view.findViewById(R.id.row_subtitle);
       subTitle.setText(cursor.getString(2));
}

My question is that while generating new list item how does the new list item contain elements from the next row of the cursor? 我的问题是,在生成新列表项时,新列表项如何包含游标下一行中的元素? Is cursor.moveToNext() automatically called? 是否会自动调用cursor.moveToNext()?

Yes, quoting the documentation (emphasis mine): 是的,引用文档 (重点是我的):

cursor The cursor from which to get the data. cursor从中获取数据的光标。 The cursor is already moved to the correct position. 光标已经移动到正确的位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM