将物品贴在recyclerview的顶部

问题描述 投票:3回答:2

我已经在SO和Google上阅读了很多关于在回收者视图中粘贴标题的问题。但是,他们中的大多数都将完整的列表项目放在首位。我只想将我的列表项的一部分放在recyclerview的顶部,直到滚动完整的项目。我已经浏览了一些像this one这样的库,但仍然无法弄清楚如何完成它。任何帮助表示赞赏。

我想粘贴红色框中突出显示的内容,直到滚动完整的列表项(标记为绿色)。

enter image description here

android android-recyclerview sticky stickyrecycleview
2个回答
2
投票

所以你想只列出你的列表项链接的一部分吗? enter image description here

看看这个图书馆 https://github.com/oubowu/PinnedSectionItemDecoration 与此RecyclerView适配器库结合使用: https://github.com/CymChad/BaseRecyclerViewAdapterHelper


0
投票

试试这个!!

这将使所选(项目位置)项目粘在顶视图上

recyclerView.setAdapter(adapter);
recyclerView.scrollToPosition(item_posotion);
adapter.notifyDataSetChanged();
© www.soinside.com 2019 - 2024. All rights reserved.