1

I have a recyclerView with 100+ items. When user will open the activity containing the recyclerView, recyclerView's bottom should be visible without any scrolling effect. Directly last page of the adapter should be shown like whatsapp's chatting page.

I have tried by following way, but it is showing the scrolling effect when user opens the activity.

recyclerView.smoothScrollToPosition(list.size()); 

2 Answers 2

14

You can scroll to last position of recycler view by adding this line

recyclerView.scrollToPosition(YourArraylist.size()-1); 

add this after setting adapter

Sign up to request clarification or add additional context in comments.

Comments

5

LinearLayoutManager.setReverseLayout(true); this should do the trick

Documentation

Used to reverse item traversal and layout order. This behaves similar to the layout change for RTL views. When set to true, first item is laid out at the end of the UI, second item is laid out before it etc. For horizontal layouts, it depends on the layout direction. When set to true, If RecyclerView is LTR, than it will layout from RTL, if RecyclerView} is RTL, it will layout from LTR. If you are looking for the exact same behavior of setStackFromBottom(boolean), use setStackFromEnd(boolean)

2 Comments

but will this add items starting from bottom ??
use use setStackFromEnd(boolean) if you want items in original order, but just starting from bottom

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.