簡體   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