Android 中的适配器方法?
我已经了解了适配器类中的三种方法。
- getView()
- newView()
- bindView()
这些方法有什么区别?请分享一些教程、示例代码或逻辑来理解这一点。谢谢。我必须创建一个带有渐进式图标的列表视图。你建议我用哪个适配器来做到这一点?
i have go through the three methods in Adapters classes.
- getView()
- newView()
- bindView()
what are the difference between those methods? please share some tutorial, sample code or logics to understand this. Thanks. i have to create a listview with the progressive icons. which adapter you suggest me to do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
getView()
返回行的View
。对于 ArrayAdapter 的自定义子类,您通常会重写 getView()。对于
CursorAdapter
的自定义子类,您可以重写getView()
,但通常您重写newView()
并且而是用bindView()
。newView()
创建行视图,bindView()
将Cursor
数据集中特定位置的数据附加到该行。这段摘录getView()) a> 来自我的一本书。
getView()
returns theView
for a row. For a custom subclass ofArrayAdapter
, you typically overridegetView()
.For a custom subclass of
CursorAdapter
, you could overridegetView()
, but usually you overridenewView()
andbindView()
instead.newView()
creates the row View andbindView()
attaches the data for the specific position in theCursor
's data set to that row.These concepts are covered (with more emphasis on
getView()
) in this excerpt from one of my books.