Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to keep RecyclerView always scroll bottom

I Use Recyclerview Replace with list view I want to keep Recyclerview always scroll bottom.

ListView can use this method setTranscriptMode(AbsListView.TRANSCRIPT_MODE_ALWAYS_SCROLL)

RecyclerView I use method smoothScrollToPosition(myAdapter.getItemCount() - 1)

but when Soft keyboard Pop ,its replace RecyclerView content.

like image 942
lj wang Avatar asked Nov 19 '14 12:11

lj wang


People also ask

How do I scroll to the bottom of my recycler view?

Recyclerview scroll to bottom using scrollToPositon. After setting the adapter, then call the scrollToPosition function to scroll the recycler view to the bottom.

How scroll RecyclerView to bottom in android programmatically?

mLinearLayoutManager = new LinearLayoutManager(this); recyclerView. setLayoutManager(mLinearLayoutManager); 3). On your Button onClick , do this to scroll to the bottom of your RecyclerView .

Is RecyclerView scrollable?

To help you build apps with lists, Android provides the RecyclerView . RecyclerView is designed to be very efficient, even with large lists, by reusing, or recycling, the views that have scrolled off the screen.

What is linear layout manager in Android?

LayoutManager implementations that lays out items in a grid. WearableLinearLayoutManager. This wear-specific implementation of LinearLayoutManager provides basic offsetting logic for updating child layout. A RecyclerView. LayoutManager implementation which provides similar functionality to ListView .


1 Answers

If you want to keep the scroll position anchored to the bottom of the RecyclerView, it's useful in chat apps. just call setStackFromEnd(true) to on the LinearLayoutManager to make the keyboard keep the list items anchored on the bottom (the keyboard) and not the top.

like image 197
Kirill Kulakov Avatar answered Sep 20 '22 10:09

Kirill Kulakov