将 UI 元素链接到复杂链接项中的数据?

发布于 2024-09-12 07:40:46 字数 264 浏览 5 评论 0原文

如何将复选框和更大的 TextView 链接到外部数据?我应该使用 SimpleCursorAdapter 吗?或者创建我自己的适配器?它应该扩展 ArrayAdapter 还是 BaseAdapter?
我的列表项 UI:

列表项 UI

How can I link like the Checkbox and larger TextView to external data? Should I use a SimpleCursorAdapter? Or create my own adapter? Should it extend ArrayAdapter or BaseAdapter?
My list item UI:

The list item UI

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

知你几分 2024-09-19 07:40:46

如果您将该视图绑定到 SQLite 数据库中的数据,我将扩展 CursorAdapter。这非常简单,因为您只需重写 bindView() 和 newView() 即可。在 newView() 中,您需要使用 LayoutInflater 来膨胀视图,而在 bindView() 中,您将视图定义为对象并将数据绑定到它们!询问您是否需要一些示例代码,我会从旧项目中挖掘一些!

If you are binding that view to data in a SQLite database, I would extend CursorAdapter. It's pretty easy as you only have to override bindView() and newView(). In newView() you need to use a LayoutInflater to inflate the view, and in bindView(), you define the views as objects and bind your data to them! Ask if you need some example code and I'll dig some up from an old project!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文