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
52
votes
5 answers

RecyclerView 2 Columns with CardView

I have a problem with my layout. I'm trying to do something like this: For now, i have a RecyclerView with a CardView inside it. in the CardView I have put an ImageView and a TextView but I don't know why but the CardView is more height than…
52
votes
3 answers

Android RecyclerView with GridLayoutManager make item span multiple rows

I have a collection of photos, and I'm using a RecyclerView to display them. I want to have the first element in my RecyclerView span 2 columns AND 2 rows: I know I can span 2 columns with setSpanSizeLookup: GridLayoutManager gridLayoutManager =…
Adam Johns
  • 35,397
  • 25
  • 123
  • 176
52
votes
5 answers

RecyclerView change data set

I want to implement search functionality for my RecyclerView. On text changed i want to change the data that are displayed with this widget. Maybe this question has been asked before or is simple, but I don't know how the change the data that is to…
Sandra
  • 4,239
  • 10
  • 47
  • 80
51
votes
13 answers

: Can't access the Fragment View's LifecycleOwner when getView() is null i.e., before onCreateView() or after onDestroyView()

I am using live data in my application for all the network calls and response handling. In one of the scenarios, my recycler view is loading some data in its view holder's onBind and the response is updating the UI. In order to do so, I have to…
Utkarsh Singh
  • 511
  • 1
  • 4
  • 3
51
votes
6 answers

An instance of OnFlingListener already set in Recyclerview

I'm using a RecyclerView in my Android app. I've many cardviews in my RecyclerView, such that only 1 cardview is displayed to the user at a time. The user has to swipe to see the next card. I faced an issue that when user makes a swipe, the…
Nitya
  • 583
  • 2
  • 5
  • 10
51
votes
5 answers

RecyclerView steals focus when inside a NestedScrollView

When I put a RecyclerView inside a nested scrollview, the screen always jumps to the top of the RecyclerView instead of the top of the page. Here is a simple example. layout xml:
breakline
  • 5,776
  • 8
  • 45
  • 84
51
votes
3 answers

Hide/Show Toolbar programmatically on CoordinatorLayout

When I scroll my RecycleView ToolBar hide or show (with animation). How I can return ToolBar back programmatically?
Artem
  • 4,569
  • 12
  • 44
  • 86
51
votes
8 answers

how to highlight the selected Item of Recycler View?

I have a Recycler View with the Images loaded from the Internal Storage. I want to Highlight the selected item when clicked. I tried a lot of thing but it was not working. Actually what I need is when I click any item in Recycler View that Item must…
Kuldeep Dubey
  • 1,097
  • 2
  • 11
  • 33
50
votes
10 answers

Android how can I get current positon on recyclerview that user scrolled to item

In my RecyclerView I have some items that user can scroll and see that. Now I want to save this position and scroll that after come back. This below code return 0 always and I can't save…
DolDurma
  • 15,753
  • 51
  • 198
  • 377
50
votes
5 answers

RecyclerView - get all existing views/viewholders

I want to update the RecyclerView while it's displaying data, in my case, I show images with or without labels. Defaultly I set the visibility of the label when I create the view holder and that's fine, but I want the user to change the labels…
prom85
  • 16,896
  • 17
  • 122
  • 242
50
votes
4 answers

Drag and drop items in RecyclerView with GridLayoutManager

What I want to achieve: Have a RecyclerView with GridLayoutManager that supports drag'n'drop and that rearranges the items while dragging. Side note: First time developing anything with drag and drop. There are a lot of topics on how to achieve this…
49
votes
11 answers

How to make a page indicator for horizontal recyclerview

Any idea how to create a page indicator for recyclerview list ?
Nima
  • 1,892
  • 4
  • 24
  • 32
49
votes
10 answers

Decorating RecyclerView (with GridLayoutManager) to display divider between items

What's the best and easiest way to decorate RecyclerView to have such look & feel? The main challenge here is having dividers only between items, but not between items and left/right borders of screen. Any ideas?
AlexKorovyansky
  • 4,873
  • 5
  • 37
  • 48
49
votes
6 answers

Embedding ads within Recyclerview

I am trying to upgrade my app from listview to recyclerview. When I was using listview I had embedded ads within the listview using this tutorial. I am not able to add it within recyclerview similarly. Any views on how this is to be done in a…
Psypher
  • 10,717
  • 12
  • 59
  • 83
49
votes
3 answers

Span multiple columns with RecyclerView

So what I am trying to go for is having a staggered layout but the first item in the list needs to span two columns. The first two rows are also a fixed height. I have everything working except the first item spanning two columns. I am using the…
DDukesterman
  • 1,391
  • 5
  • 24
  • 42