与光标适配器绑定的列表视图 - 如何添加默认的第一个条目
将第一个默认项添加到列表视图(从 CursorAdapter 获取数据)的常见方法是什么?我想要一个包含项目的列表视图,其中第一个条目类似于“添加项目”。 制作自定义适配器不会有帮助,因为它会弄乱光标项目计数。
What is the common way to add a first default item to the listview, which takes it's data from a CursorAdapter? I would like to have a listview with items where the first entry is something like "Add item".
Making a custom adapter won't help because it would mess up the cursor item count.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在您的情况下,最好的解决方案是使用方法 addHeaderView。
为什么你要从cursorAdapter获取第一项的数据?只需将 TextView 设置为标题视图即可。
In your situations the best solution is using the method addHeaderView.
Why do u want taking data from cursorAdapter for the first item? Just set a TextView as a header view.
尝试使用带有联合的选择,
例如
Try using a select with union
like