我有一些数据游标。我有TextView的可见性取决于光标项目的某些属性。我使用SimpleCursorAdapter并重写getView方法。但是我实际上并没有使用SimpleCursorAdapter的属性。将适配器更改为CursorAdapter并覆盖newView和bindView方法是否更好?

最佳答案

CursorAdapter是抽象的,将被扩展。另一方面,SimpleCursorAdapter不是抽象的。

请注意,newView(Context context,Cursor cursor,ViewGroup parent)在CursorAdapter中是抽象的,但在SimpleCursorAdapter中实现。这是因为SimpleCursorAdapter具有特定的机制来初始化 View ,而CursorAdapter则将 View 交给开发人员。

资料来源:SimpleCursorAdapter and CursorAdapter

已添加:
I have TextView which visibility depends on some property of the item of cursor.
为此,您可以检查SimpleCursorAdapter.ViewBinder接口(interface)。

关于android - SimpleCursorAdapter与CursorAdapter?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12652049/

10-12 04:23