Call onBindViewHolder when scrolling through a Recycler view

I have a list of images in my Recycler view and onBindViewHolder is called when scrolling through the list of recyclers.

I want to call onBindViewHolder again when I view the recycler view to get the position of the image currently being viewed.

How to call onBindViewHolder again (when scrolling up)?

+4
source share
1 answer

, recycler, , dy , adapter.notifyDataSetChanged, onBindViewHolder

   mFragmentListBinding.movieGrid.addOnScrollListener(new RecyclerView.OnScrollListener() {
            @Override
            public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
                super.onScrolled(recyclerView, dx, dy);
                if (dy < 0) {
                   mAdapter.notifyDataSetChanged();
                }
            }
        });
+2

Source: https://habr.com/ru/post/1674030/


All Articles