Questions tagged [android-recyclerview]

The RecyclerView widget is a more advanced and flexible version of ListView and GridView.

The RecyclerView widget is a more advanced and flexible version of ListView and GridView. This widget is a container for displaying large datasets that can be scrolled very efficiently by maintaining a limited number of views. Use the RecyclerView widget when you have data collections whose elements change at runtime based on user action or network events.

• See how to create a list with RecyclerView.


RecyclerApdater Adapter optimized for RecyclerView

The RecyclerView class simplifies the display and handling of large data sets by providing:

  1. Layout Managers for positioning items
  2. Default animations for common item operations, such as removal or addition of items

enter image description here

Tag Usage:

29237 questions
7
votes
5 answers

Android - Get current position from recyclerview with listener when position changed

I'm working with recyclerview with snaphelper. This is my recyclerview: final LinearLayoutManager lm = new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false); recyclerview.setLayoutManager(lm); final…
Yoni
  • 1,346
  • 3
  • 16
  • 38
7
votes
4 answers

RecyclerView items clicking while scrolling

I have a RecyclerView. Inside its adapter's onBindViewHolder() I set the OnClickListener to the ViewHolder's root layout. However, I've recently noticed that I can't click on the RecyclerView's items while it's being scrolled. Only after it's…
Sergiy
  • 221
  • 3
  • 11
7
votes
4 answers

Recyclerview not displaying items

Before setting the dataset to the adapter, I am getting the dataset from the Room database, and then I set the data to the adapter and set the adapter to the recyclerview. Currently there are 2 items in the list. From my logs I see that all methods…
androgirl
  • 355
  • 2
  • 7
  • 17
7
votes
2 answers

Scrolling issue in horizontal recyclerview in a scrollview

I have a scroll view in my home page, inside that scroll view there are 2 layouts each layout for a recyclerview, each recyclerview will scroll horizontally. When I try to scroll the recyclerview the scroll of scrollview is getting intruppted and…
7
votes
3 answers

Getting two different views in single RecyclerView using Firebase in Android

I have developed an application in which there are two posts The image post using picasso the Video post using Youtube Api. I have implemented both by using RecyclerView and Firebase recyclerAdapter but the problem is that I dont know that how to…
7
votes
1 answer

How to enable a PagerSnapHelper to snap in both directions in a RecyclerView?

I've attached a PagerSnapHelper to a RecyclerView with a Horizontal LinearLayoutManager using below code. SnapHelper snapHelper = new PagerSnapHelper(); snapHelper.attachToRecyclerView(myRecyclerView); However, when I perform scroll, snapping…
rush
  • 413
  • 2
  • 5
  • 13
7
votes
2 answers

No views in hierarchy found matching: is assignable from class: class android.widget.AdapterView

I am trying to get the recycle view using onData but i am stuck in this error: No views in hierarchy found matching: is assignable from class: class android.widget.AdapterView The code is just…
MiguelSlv
  • 14,067
  • 15
  • 102
  • 169
7
votes
4 answers

Understanding RecyclerView.ViewHolder

I'm having hard time understanding working of view holder, here are my some question that could increase my understanding of viewholder: It is said that oncreateViewHolder returns viewholder object, What is viewholder object does it contain all the…
blackHawk
  • 6,047
  • 13
  • 57
  • 100
7
votes
3 answers

Android | AlertDialog on RecyclerView Item Click

I have implemented a RecyclerView. Now I want to display an AlertDialog when an item of RecyclerView is clicked. I tried many ways and none of them worked. Here is my adapter class, public class SearchResultAdapter extends…
7
votes
7 answers

RecyclerView does not update after removing an item

I have a RecyclerView horizontal image slider at the bottom of a fragment. The top of the fragment shows some details. Once the user clicks on the images at the bottom, the idea is to remove that image from the image slider and display its…
7
votes
3 answers

How to prevent auto scroll in RecyclerView after notifyDataSetChanged?

I have a RecyclerView with several items types. It looks like this: 07/21/2017 Message 1 Message 2 Message 3 07/22/2017 Message 4 New messages header Message 5 Message 6 When new messages arrived I sort it by date and call notifyDataSetChanged().…
BArtWell
  • 4,176
  • 10
  • 63
  • 106
7
votes
3 answers

IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling

I am trying to remove an item from my RecyclerView, but I always get an error. java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling I am using notifyDataSetChanged(). How can I solve…
7
votes
3 answers

How to save scroll position of recyclerview in fragment

I have followed so many answers from here.. but not a single one solving my issue .. that's why i am asking. I want to save scroll position in a fragment. In So many articles they have suggested to follow @Override protected void…
Tapan Kumar Patro
  • 767
  • 1
  • 7
  • 18
7
votes
5 answers

Prevent RecyclerView to scroll by hand

I have a list of items like an album and I show it by RecyclerView. Also, each item has a button to send some data to the server by clicking and then scroll to the next position in list. So my question is: How to prevent RecyclerView from scrolling…
FarshidABZ
  • 3,860
  • 4
  • 32
  • 63
7
votes
3 answers

Is it possible to hide the ItemDecoration for the last item in a RecyclerView?

I'm using the RecyclerView.ItemDecoration class to create dividers in the list, but I want to hide the divider for the last item in the list. Is this possible without having to implement the dividers myself?
fobbymaster
  • 1,406
  • 3
  • 14
  • 22