繁体   English   中英

Horizontal RecyclerView - when selected item is out of viewport (scrolling left/right), change background of the most left/right item

[英]Horizontal RecyclerView - when selected item is out of viewport (scrolling left/right), change background of the most left/right item

所以我有一个可以左右滚动的水平回收视图(其中大约 50 个项目)。 当回收器视图中的选定项目超出视口时,因为我向右滚动,我想更改最右侧项目的背景,作为选定项目在右侧的指示器,如果我向左滚动,则相同。

不确定我是否可以使用 findLastCompletelyVisibleItemPosition(),因为我将如何获得最右侧/最左侧项目的 position?

要获得最右边的项目,您可以使用findLastCompletelyVisibleItemPosition()并获得最左边的项目,您可以使用findFirstCompletelyVisibleItemPosition()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM