I am trying to implement messenger, so I used for that RecyclerView with stackFromEnd = true
option. And I faced a problem, when I insert new item to the list my recycler view scrolls up to one item, instead of staying at last. I suppose it is cause of stackFromEnd
parameter. Can someone explain little bit what is happening with my RecyclerView? By the way I used DiffUtil
in order to update items in list, but it works ok, cause my edit message function works properly. My adding functions looks like this
fun addNewMessage(message: ChatMessageUi) {
messages.add(message)
submitList(messages)
}
Here as you can see I used submitList()
method cause in all articles that I read about DiffUtil
, when mention insertion of new item, they advise to use submitList()
function, but it did not help me.