-3

I want to check whether the recyclerview item row is currently visible on screen or not, not getting the exact solution.

(And Please I'm NOT Searching for:This: Get visible items in RecyclerView ).

In RecyclerView.Adapter:


@Override
    public void onBindViewHolder(final MainVH holder, final int position) {...
    ...
...
int firstvisItemPosition =  manager.findFirstVisibleItemPosition();
        if (holder.imgGridImage != null && (firstvisItemPosition == position)) {
            holder.imgGridImage.setTag(1);
        } else {
            holder.imgGridImage.setTag(0);
        }
.
.
.
AND
.
.
.
holder.imgGridImage.getTag()

is not working for me, Can any one help me?

Community
  • 1
  • 1
Chintan Raghwani
  • 3,370
  • 4
  • 22
  • 33

1 Answers1

0

You can check last row is visible or not by applying following method.

layoutManager.findLastCompletelyVisibleItemPosition() == adapter.getItemCount() - 1

if it returns true then last raw is visible.

Jay Shah
  • 732
  • 4
  • 16