The RecyclerView.scrollToPosition()
is extremely strange.
for example, supposed a RecyclerView
named "rv"
.
if now item 10 is under the current RecyclerView
, call rv.scrollToPosition(10)
, the RecyclerView
will scroll item 10 to bottom.
if now item 10 is in the current RecyclerView
, call rv.scrollToPosition(10)
, there won't be any scrolling, nothing will be done.
if now item 10 is on the top of the current RecyclerView
, call rv.scrollToPosition(10)
, the RecyclerView
will scroll item 10 to top.
To help understanding, look at this picture
But what i need is that, whenever i call it, the RecyclerView
will scroll the supposed position to the top of current view just like case 3. How to do that?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…