简体   繁体   English

对话框中的Bug RecyclerView.scrollToPosition(list.size() - 1)

[英]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.

相关问题 recyclerview.scrollToPosition(adapterarray.size()-1) 导致项目以相反的顺序出现 - recyclerview.scrollToPosition(adapterarray.size()-1) causes to bring the items in reversed order 为什么recyclerview不添加所有list.size? - Why the recyclerview don't add all list.size? !list.isEmpty() 和 list.size()&gt;0 是否相等? - Is !list.isEmpty() and list.size()>0 equal? 相当于BitSet的list.size()是什么? - Whats the list.size() equivalent of the BitSet? 为什么 list.size()&gt;0 在 Java 中比 list.isEmpty() 慢? - Why is list.size()>0 slower than list.isEmpty() in Java? 为什么运行时间复杂(清单 <Object> )list.size()是O(1)吗? - Why the running time complexity of (List<Object>) list.size() is O(1)? 使用 list.size() 或变量进行多次使用? (局部优化) - Use list.size() or a variable for multiple use ? (local optimization) 继续调用 array.length 或 list.size() 的性能损失 - Performance loss of continued call to array.length or list.size() for(int i = 0,length = list.size; i有什么区别 - What is the difference between “for(int i=0,length=list.size;i<length;i++) ” and “for(int i=0;i<list.size;i++) ”? 当A Thread(list.add())和B Thread(list.size())工作时,此行如何工作? - how this line works when A Thread(list.add()) and B Thread(list.size()) works?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM