RecyclerView stackFromBottom [英] RecyclerView stackFromBottom
问题描述
我刚刚实现了新的RecyclerView
.我想使用它来显示用户的消息(短信).
I just implemented the new RecyclerView
. I want to use it do display user's messages(sms).
我在官方文档中读到,RecyclerView
是新的和改进的ListView
(类似),我们应该使用它来获得更好的性能.
I read on official documentation that RecyclerView
is a new and improved ListView
(something like that) and we should use it for better performance.
一切都很顺利,直到我想显示用户的对话并且我希望消息从底部开始显示.在ListView
中,我通常会使用android:stackFromBottom="true"
,但是当我在RecyclerView
中尝试此操作时,它不起作用(即使没有收到任何错误).
Everything went great until I wanted to display a user's conversation and I want the messages to be displayed starting from the bottom. In a ListView
I would normally use android:stackFromBottom="true"
but when I tried this in the RecyclerView
it didn't work (even if didn't receive any error).
有人知道如何使RecyclerView
的物品从底部堆叠吗?谢谢.
Does anyone know how to make the RecyclerView
's items to be stacked from bottom? Thank you.
推荐答案
感谢tyczj的评论,我知道了.在RecyclerView
而不是stackFromBottom
中,您必须使用stackFromEnd
https://developer.android.com/reference/android/support/v7/widget/LinearLayoutManager.html#setStackFromEnd(boolean)
Thanks to tyczj's comment I figured it out. In RecyclerView
instead of stackFromBottom
you have to use stackFromEnd
https://developer.android.com/reference/android/support/v7/widget/LinearLayoutManager.html#setStackFromEnd(boolean)
这篇关于RecyclerView stackFromBottom的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!