I have a RecyclerView
which im using to display messages, in a text app type way. By that I mean, new messages added to the RecyclerView
should appear on the bottom.
Currently, im using .setStackFromEnd(true)
on my LinearLayoutManager
to make messages appear starting from the bottom:
layMng = new LinearLayoutManager(this);
layMng.setStackFromEnd(true);
mRecyclerView.setLayoutManager(layMng);
mRecyclerView.setAdapter(mAdapter);
What happens is, when enough messages are received and the list of messages is about to overflow past the top of the screen, it stops always showing the new messages at the bottom. I have to scroll down manually to see the new additions.
How can I get it to either always have the newest message be viewable or have the RecyclerView
scroll down when a new item is received?
I tried various methods on my layout manager like .scrollToPosition()
and .scrollToPositionWithOffset()
but none of the suggestions i've seen so far have worked. A few of the top StackOverflow questions on the issue have top answers that dont even solve the original question..
So how is this done?