I am using a recycler view in reverse order to display a chat History.
If there is only one message in a chat, it display the message in the bottom (like telegram). But i need to display it from the top.
I am stuck in this for a day. Can anyone please give me a suggestion to display the message from top in recyclerview reverse order (like whatsapp).
setReverseLayout(true) does the trick.
You can also use this:
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); linearLayoutManager.setReverseLayout(true); linearLayoutManager.setStackFromEnd(true); myRecyclerView.setLayoutManager(linearLayoutManager);
I faced same problem some day's ago. Whatever I solve this by this way.
<android.support.v7.widget.RecyclerView android:id="@+id/reyclerview_message_list" android:layout_width="match_parent" android:layout_height="wrap_content" android:scrollbars="vertical" app:stackFromEnd="true" app:reverseLayout="true"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With