英文:
Android Recycle View Scrolling
问题
以下是您要翻译的内容:
"hi I am building chat app using firebase realtime , facing issue with scrolling to last message -Bottom- when new message received , its working fine scrolling and every thing but not showing full height for the last item
here is my code
binding.items.smoothScrollToPosition(adapter.itemCount);
if any code to scroll with offset and how to calculate offset for dynamic height for message"
英文:
hi I am building chat app using firebase realtime , facing issue with scrolling to last message -Bottom- when new message received , its working fine scrolling and every thing but not showing full height for the last item
here is my code
binding.items.smoothScrollToPosition(adapter.itemCount);
if any code to scroll with offset and how to calculate offset for dynamic height for message
答案1
得分: 1
我找到了使用的解决方案:
layoutManager.stackFromEnd = true
最终的代码是:
val layoutManager = binding.items.layoutManager as LinearLayoutManager
layoutManager.stackFromEnd = true
binding.items.smoothScrollToPosition(adapter.itemCount)
英文:
I found soultion to use
layoutManager.stackFromEnd = true
final code is
val layoutManager = binding.items.layoutManager as LinearLayoutManager
layoutManager.stackFromEnd = true
binding.items.smoothScrollToPosition(adapter.itemCount)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论