Android:跳到给定输入字符或字符串的列表视图位置

发布于 2024-09-28 17:19:34 字数 156 浏览 3 评论 0原文

有人可以告诉我,当从 onClick 方法给出字符或字符串输入时,如何跳到按字母顺序排序的 ListView 中的某个位置?

例如,我有一个传回字符的对话框。如果该字符是 BI,则希望列表视图跳到第一个 B 条目。

任何帮助将不胜感激。

谢谢, 乔什

Can someone tell me how to skip to a position in an alphabetically sorted ListView when given a char or string input from an onClick method?

For example, I have a dialog that passes back a char. If that char is a B I want the listview to skip to the first B entry.

Any help would be greatly appreciated.

Thanks,
Josh

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

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

发布评论

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

评论(1

王权女流氓 2024-10-05 17:19:34

如果您的列表视图包含如此多的条目,这是必要的,那么简单地删除除“b”条目之外的所有条目不是​​有益的吗?因此,您的列表视图将自动显示“b”,并且仅显示“b”。如果将条目转储到列表或数组对象中,这应该很容易做到。

我意识到这并不能直接回答您的问题,但有时获得有关设计方面的外部反馈可能会有所帮助。

另外,X 是你的第一个“b”项是否

myListview.Items(X).Selected = true;

解决了问题?

If your listview contains so many entries that this is necessary, wouldn't it be beneficial to simply remove all but the "b" entries? Thus your listview would automatically show the "b's" and only the "b's." It should be pretty easy to do that if you dump the entries into a list or array object.

I realize this doesn't directly answer your question, but sometimes it can be beneficial to get outside feedback on a design aspect.

Also, doesn't

myListview.Items(X).Selected = true;

where X is your first "b" item solve the problem?

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