0

i want to let the recycleview item scroll to top by click one button.and i use lineLayoutManger.scrollToPositionWithOffset(position,0); the position is i want to scroll item postion.but when i go into the Activity and have init the adapter.but when i click the buttton to let fifth item scroll to top. but it just on bottom of the screen. if i click the button again it show normal the fifth item is on top.the items are not the same height. whate should i do.i have search many article.but have no answer.thanks the wrong effect picturesee this picture

4

2 回答 2

0

get linearLayoutManager from your recyclerView List like this:

((LinearLayoutManager) mList.getLayoutManager()).scrollToPositionWithOffset(mPositionToScroll, 0);
于 2017-06-13T10:06:39.400 回答
0

Please let me know the way you define your recyclerview

于 2017-06-13T10:26:34.910 回答