开发者

Reset List Scroll Position When Entering Search Text

开发者 https://www.devze.com 2023-02-20 13:43 出处:网络
How can I reset the list scroll position to the top when providing a new set of suggestions? When providing custom search suggestions to the Search Dialog the scroll position doesn\'t reset when typi

How can I reset the list scroll position to the top when providing a new set of suggestions?

When providing custom search suggestions to the Search Dialog the scroll position doesn't reset when typing more characters after scrolling down the suggestions list.

This is easy to reproduce in the Quick Search Box when configured to look for contacts:

  • Open QSB
  • Select Contacts from the corpus options
  • Type in something that yields more than one full screen of results, say "a"
  • Swipe up to reveal suggestions from the bottom of the list

The keyboard soft-input keyboard will hide, revealing a full height list-view of suggestions. And the scroll position is now away from the top

Although the cursor re-queries and new suggestions are presented, the list does not scroll back to the top

My use of the Search Dialog suffers the same behaviour, and the user experience is poor. I am providing custom suggestions from an HTTP API that

I've noted that the other corpus options limit their suggestions to only one screen-height of suggestions, avoiding this problem altogether.


Try using ListView's "smoothScrollToPosition(0)" to scroll back to the first entry when the user types in more characters. Is that what you mean by resetting the list?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号