[英]Bug RecyclerView.scrollToPosition(list.size()-1) in Dialog
I have created RecyclerView with list of clients (from 0 till 14). 我创建了带有客户列表的RecyclerView(从0到14)。 I need maximum down state. 我需要最大限度的状态。 For this purpose I am using method RecyclerView.scrollToPosition(14). 为此我使用方法RecyclerView.scrollToPosition(14)。
When RecyclerView are placing in Activity, I have the good result. 当RecyclerView放入Activity时,我得到了很好的结果。
IMAGE: RecyclerView are placing in Activity IMAGE:RecyclerView正在放置在Activity中
And now I am inflating new RecyclerView and put it in Dialog. 现在我正在给新的RecyclerView充气,并把它放在Dialog中。 The Adapter of RecyclerView the same. RecyclerView适配器也一样。 Method RecyclerView.scrollToPosition(14) give me the bad result (scroll is not set on the 14th position, by the way I can pull it to the down manually): 方法RecyclerView.scrollToPosition(14)给出了不好的结果(滚动没有设置在第14个位置,顺便说一下我可以手动将它拉到向下):
IMAGE: Bad result in Dialog 图像:对话框中的结果不佳
Why it happens? 为什么会这样? I think the problem in parent (Dialog) of RecyclerView. 我认为在RecyclerView的父(Dialog)中存在问题。 But I don't know what to do. 但我不知道该怎么办。
UPDATED! 更新! I think this is a really bug of RecyclerView. 我认为这是RecyclerView的一个真正的错误。 Because with ListView is all right (in my case with setSelection(14)). 因为ListView是可以的(在我的情况下使用setSelection(14))。
Because your interaction panel hide the last element. 因为您的交互面板隐藏了最后一个元素。 Position your recycler view above the panel. 将回收者视图放在面板上方。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.