RecyclerView-倒序 [英] RecyclerView - Reverse Order

查看:126
本文介绍了RecyclerView-倒序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在以相反的顺序使用回收站视图以显示聊天记录.
如果聊天中只有一条消息,则会在底部显示该消息(例如电报).但是我需要从顶部显示它.
我在这里呆了一天.任何人都可以给我一个建议,以recyclerview反向顺序从顶部显示消息(例如whatsapp).

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).

推荐答案

您还可以使用以下方法:

You can also use this:

LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
linearLayoutManager.setReverseLayout(true);
linearLayoutManager.setStackFromEnd(true);
myRecyclerView.setLayoutManager(linearLayoutManager);

这篇关于RecyclerView-倒序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆