Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[EoS] Fix scrolling issues caused by LinearLayoutManager
RecyclerViews inherently have two data models that are kept in "sync": * The child views that are actually on the RecyclerView * the model provided by the Adapter. We use LinearLayoutManager#scrollToPosition when the model is loaded to scroll to a particular card. Normally this scrolls the card to the top of the view. However, if the model provided by the Adapter has more items than the recyclerview has children, and the scroll request is for an item out of range of the child count, then the layout manager will only scroll the view to the bottom of the RecyclerView ! (see https://cs.chromium.org/chromium/src/third_party/android_tools/sdk/sources/android-25/android/support/v7/widget/LinearLayoutManager.java?rcl=e958d6ea74442d4e0849bb8a018d215a0e78981d&l=850) for details) We can work around this by using LinearLayoutManager#scrollToPositionWithOffset with an offset of 0, which disables the only-scroll-into-view logic. Bug: 915378 Change-Id: Ic25e7e90558c5bed953995e359cb03dff8010219 Reviewed-on: https://chromium-review.googlesource.com/c/1396704 Reviewed-by: Cathy Li <chili@chromium.org> Reviewed-by: Theresa <twellington@chromium.org> Commit-Queue: Justin DeWitt <dewittj@chromium.org> Cr-Commit-Position: refs/heads/master@{#620410}
- Loading branch information