拦截行动SimpleCursorAdapter [英] Intercepting SimpleCursorAdapter Action
问题描述
我写其使用SimpleCursorAdapter显示来自我的SQLite数据库的项目的列表的应用程序。该应用程序是一个列表应用程序,其允许用户创建的项目的列表。有一个在数据库中保存的用户是否希望该列表项的文字划掉与否。轨道领域
基本上,我想拦截的时间,其中SimpleCursorAdapter尝试的setText()在我的crossed_out场点,而是调用一个函数来设置另一个字段的文本删除线。
这是可能没有写我自己的CursorAdapter?我如果不是如何去写我自己的CursorAdapter?
这是可能没有写我自己的CursorAdapter?
块引用>您可以
ViewBinder
使用<一个附加一href=\"http://developer.android.com/reference/android/widget/SimpleCursorAdapter.html#setViewBinder%28android.widget.SimpleCursorAdapter.ViewBinder%29\"相对=nofollow>setViewBinder()
,并实施ViewBinder
来格式化你的TextViews
如你所愿。
如果不是我可以去写我自己的CursorAdapter?
块引用>第1步:创建
的子类SimpleCursorAdapter
第二步:覆盖<一个href=\"http://developer.android.com/reference/android/widget/SimpleCursorAdapter.html#setViewText%28android.widget.TextView,%20java.lang.String%29\"相对=nofollow>
setViewText()
并在这一点适用您的格式,或覆盖bindView()
并在所有行填充部件自己I am writing an application which is using a SimpleCursorAdapter to display a list of items from my SQLite Database. The application is a list application, which allows the user to create a list of items. There is a field in the database that keeps track of whether the user wants the list item's text crossed out or not.
Basically, I want to intercept the point in time where the SimpleCursorAdapter tries to settext() on my crossed_out field, and instead call a function to set the text of another field to strikethrough.
Is this possible without writing my own CursorAdapter? If not how can I go about writing my own CursorAdapter?
解决方案Is this possible without writing my own CursorAdapter?
You can attach a
ViewBinder
usingsetViewBinder()
, and implement aViewBinder
to format yourTextViews
as you wish.If not how can I go about writing my own CursorAdapter?
Step #1: Create a subclass of
SimpleCursorAdapter
Step #2: Override
setViewText()
and apply your formatting at that point, or overridebindView()
and fill in all of the row widgets yourself这篇关于拦截行动SimpleCursorAdapter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!