如何强制 AutoCompleteTextView 更新下拉菜单的高度?
我的应用程序中有一个 AutoCompleteTextView,它连接到远程站点以获取建议。在获取建议时,我会显示一个项目列表,其中显示“正在搜索,请稍候”。请求完成后,我更新建议列表适配器并调用 notifyDataSetChanged
。
然后列表内容更改为新建议(如预期),但不知何故列表的高度仍为 1 个单元格,因此只有顶部建议可见。如何强制视图重新计算下拉高度?
I have an AutoCompleteTextView
in my app that connects to a remote site to fetch suggestions. While suggestions are fetched I show a list of one item saying "searching, please wait". After the request completes, I update the suggestion list adapter and call notifyDataSetChanged
.
Then the list contents changes to new suggestions (as expected), but somehow the list remains 1 cell in height, so that only the top suggestion is visible. How to force the view to re-calculate the dropdown height?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
似乎
showDropDown()
强制重新评估建议列表高度。不幸的是,它也迫使它显示出来,但就我的目的而言,这是可以接受的。It seems that
showDropDown()
forces re-evaluation of the suggestion list height. Unfortunately, it also forces it to show, but for my purposes it was acceptable.