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
1115
votes
45 answers

How to add dividers and spaces between items in RecyclerView

This is an example of how it could have been done previously in the ListView class, using the divider and dividerHeight parameters:
EyesClear
  • 28,077
  • 7
  • 32
  • 43
1056
votes
23 answers

How to create RecyclerView with multiple view types

From Create dynamic lists with RecyclerView: When we create a RecyclerView.Adapter we have to specify ViewHolder that will bind with the adapter. public class MyAdapter extends RecyclerView.Adapter { private String[]…
Pongpat
  • 13,248
  • 9
  • 38
  • 51
1044
votes
31 answers

Why doesn't RecyclerView have onItemClickListener()?

I was exploring RecyclerView and I was surprised to see that RecyclerView does not have onItemClickListener(). I've two question. Main Question I want to know why Google removed onItemClickListener()? Is there a performance issue or something…
T_V
  • 17,440
  • 6
  • 36
  • 48
672
votes
49 answers

RecyclerView onClick

Has anyone using RecyclerView found a way to set an onClickListener to items in the RecyclerView? I thought of setting a listener to each of the layouts for each item but that seems a little too much hassle I'm sure there is a way for the…
CurtJRees
  • 6,738
  • 3
  • 14
  • 9
400
votes
15 answers

How to build a horizontal ListView with RecyclerView

I need to implement a horizontal listview in my Android application. I did a bit of research and came across How can I make a horizontal ListView in Android? and Horizontal ListView in Android?. However, these questions were asked before…
Andre Perkins
  • 7,640
  • 6
  • 25
  • 39
390
votes
16 answers

How to update RecyclerView Adapter Data

I am trying to figure out what is the issue with updating RecyclerView's Adapter. After I get a new List of products, I tried to: Update the ArrayList from the fragment where recyclerView is created, set new data to adapter, and then call…
Filip Luchianenco
  • 6,912
  • 9
  • 41
  • 63
381
votes
36 answers

How to implement endless list with RecyclerView?

I would like to change ListView to RecyclerView. I want to use the onScroll of the OnScrollListener in RecyclerView to determine if a user scrolled to the end of the list. How do I know if a user scrolls to the end of the list so that I can fetch…
371
votes
13 answers

How to filter a RecyclerView with a SearchView

I am trying to implement the SearchView from the support library. I want the user to be to use the SearchView to filter a List of movies in a RecyclerView. I have followed a few tutorials so far and I have added the SearchView to the ActionBar, but…
357
votes
15 answers

RecyclerView vs. ListView

From android developer (Creating Lists and Cards): The RecyclerView widget is a more advanced and flexible version of ListView. Okay, it sounds cool, but when I saw this example picture, I got really confused about the difference between these…
Blaze Tama
  • 10,828
  • 13
  • 69
  • 129
348
votes
35 answers

RecyclerView and java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder in Samsung devices

I have a recycler view that works perfectly on all devices except Samsung. On Samsung, I'm get java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder when I'm going back to the fragment with the…
Vladimir Fisher
  • 3,090
  • 2
  • 17
  • 23
344
votes
5 answers

Is there a way to show a preview of a RecyclerView's contents in the Android Studio editor?

When I add the RecyclerView to the layout, it shows up as a blank screen. Is there a way, such as through the tools namespace, to show a preview of the content of the RecyclerView?
341
votes
51 answers

RecyclerView: Inconsistency detected. Invalid item position

Our QA has detected a bug: when rotating the Android device (Droid Turbo), the following RecyclerView-related crash happened: java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position 2(offset:2).state:3 To me, it…
341
votes
26 answers

RecyclerView inside ScrollView is not working

I'm trying to implement a layout which contains RecyclerView and ScrollView at the same layout. Layout template: ... …
329
votes
21 answers

Is there an addHeaderView equivalent for RecyclerView?

I'm looking for an equivalent to addHeaderView for a recycler view. Basically I want to have an image with 2 buttons be added as a header to the listview. Is there a different way to add a header view to a recycler view? An example for guidance…
ViciDroid
  • 3,555
  • 4
  • 14
  • 16
325
votes
38 answers

recyclerview No adapter attached; skipping layout

Just implemented RecyclerView in my code, replacing ListView. Everything works fine. The data is displayed. But error messages are being logged: 15:25:53.476 E/RecyclerView: No adapter attached; skipping layout 15:25:53.655 E/RecyclerView: No…
equitharn
  • 3,453
  • 2
  • 14
  • 17
1
2 3
99 100