It seems impossible to scroll to the bottom of a scrollview
I have searched a bunch of other SO posts with no luck.
Some solutions completely disable animations which is not what I want, I want to be able to update some cell sizes with animation, so that solution doesn't work
I don't want the scroll to animation so I can't use smoothScrolling either
val layoutManager = LinearLayoutManager(context)
binding.recyclerView.layoutManager = layoutManager
viewModel.liveData.observe(viewLifecycleOwner, Observer { result ->
result.fold({ conversations ->
binding.recyclerView.adapter = ConversationsAdapter(conversations)
// Does not work
binding.recyclerView.scrollToPosition(conversations.count() - 1)
// Does not work either
layoutManager.scrollToPosition(conversations.count() - 1)
},{
print(it)
})
})
EDIT: Also tried
binding.recyclerView.viewTreeObserver.addOnGlobalLayoutListener {
layoutManager.scrollToPosition(conversations.count() - 1)
}