Android 人口列表视图
我有一个关于在 android 中填充列表视图的非常基本的问题。现在,如果我想这样做,我可以使用 SimpleCursorAdapter,它工作得很好。但由于我的程序变得越来越复杂,我想在显示数据之前对其进行操作(您知道,也格式化字符串)我面临的问题是,在从数据库请求到 ListElements 的过程中,并没有真正的点,我可以在其中操纵数据。由于每个 ListElement 有四个 TextView,因此据我所知,ArrayAdapter 是不可能的。因为我对 Android 很陌生,所以我什至不知道要谷歌搜索什么。
非常感谢您的帮助, 丹尼尔
I have a very basic question about populating listviews in android. Right now, if I wanna do so, I use a SimpleCursorAdapter and it works very well. But since my Programm is getting more sophisticated I want manipulate the data, before it is displayed (You know, formating the Strings a.s.o.) The problem I face is, that on the way from the database request to the ListElements, there is not really an point, where I can manipulate the data. Since I have four TextViews per ListElement, the ArrayAdapter is, as far as I know, not possible. Since I am very new to Android I don't even know what to google for.
Thanks a lot for your help,
Daniel
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
执行此操作的常见方法是在适配器的
getView
中。你可以这样做:你可以找到完整的代码示例 那里。使用支架示例,您可以设置 4 个视图并更新它们。
The common way of doing so is in the
getView
of your adapter. You could do something like this :You can find full code example there. With the holder example, you can set up your 4 views and update them.