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
40
votes
4 answers

How to animate recyclerview on scroll like Google plus/Google newsstand?

How do I animate the RecyclerView when the items appear for first time and also when the user scrolls, just like the way it works for the google plus app or the google news stand app. Also I read somewhere that RecyclerView does not directly support…
T_C
  • 3,148
  • 5
  • 26
  • 46
39
votes
2 answers

Can I pass the ViewModel to a RecyclerView Adapter and observe a LiveData?

I'm started to implement MVVM and I do not know if use the ViewModel inside my Adapter is a Good Practice or an AntiPattern. To give you an example, think about a list of colors and an Image that you will change the background. In that case, I'm…
AndroidStorm
  • 859
  • 9
  • 25
39
votes
11 answers

RecyclerView - Reverse Order

I am using a recycler view in reverse order to display a chat History. If there is only one message in a chat, it displays the message at the bottom (like a Telegram). But I need to display it from the top. I am stuck in this for a day. Can anyone…
Saravanakumar
  • 391
  • 1
  • 3
  • 5
39
votes
3 answers

Disable animation on notifyItemRangeInserted()

I'm using a RecyclerView. After adding items to the RecyclerView, I need to call: notifyItemRangeInserted(int positionStart, int itemCount); However, this shows a sort of "slide down" animation. Is there a way that I can disable this…
d84619
  • 393
  • 1
  • 3
  • 4
39
votes
6 answers

Android - Detect when the last item in a RecyclerView is visible

I have a method that will check if the last element in a RecyclerView is completely visible by the user, so far I have this code The problem is how to check if the RecyclerView has reached it's bottom ? PS I have items dividers public void…
Thorvald
  • 3,424
  • 6
  • 40
  • 66
39
votes
3 answers

LayoutManager for RecyclerView Grid with different cell width

StaggeredGridLayoutManager doesn't seem to allow customising a cell width or span multiple columns (except full span) for vertical orientation. What is a preferred LayoutManager for organising cells as shown above? P.S. I just want to know how to…
random
  • 10,238
  • 8
  • 57
  • 101
39
votes
5 answers

Scrollbar color in RecyclerView

How can I change the color of my scrollbar in a recyclerView? I have the scrollbar but I want to change its color. My recyclerView is like this:
Yass
  • 547
  • 1
  • 7
  • 14
39
votes
3 answers

Setting span size of single row in StaggeredGridLayoutManager

I have a staggered grid that has 2 columns. This is working. What I want is at position 0 for the row to span across the 2 columns. I have done this before quite easily using GridLayoutManger as so: …
39
votes
6 answers

How to get Adview below Viewpager in CoordinatorLayout

At the moment the AdView is appearing inside the ViewPager so its blocking the content in the app. How can I get the AdView to appear below the ViewPager and not inside. I have tried to put the AdView in a RelativeLayout below the ViewPager but then…
39
votes
10 answers

Android Centering Item in RecyclerView

Im a newbie in android. Im not sure why I cant center my item in RecyclerView. What I want is like below image :- What android render is like below image :- Is there a way to push items in RecyclerView to center? So it will look like this :- I…
skycrew
  • 918
  • 1
  • 15
  • 30
38
votes
12 answers

Mono.Linker.MarkException: Error processing method: 'System.Void AndroidX.RecyclerView.Widget.RecyclerView/LayoutManager

I am trying to debug my Xamarin project. Framework and all packages are up to date. In iOS it works, but in Android NOT. How can I solve this problem: Mono.Linker.MarkException: Error processing method: 'System.Void…
38
votes
3 answers

Android Paging 3 - get list of data from PagingData object

I'm using new jetpack Paging 3 library. I have one specific use case. I want to share this data between two screens using viewmodel. One screen needs paged data and for the second screen I want simple list of this data (not paged list, I need to…
P.Dudik
  • 411
  • 1
  • 5
  • 4
38
votes
5 answers

Android RecyclerView in ConstraintLayout doesn't scroll

I have a recyclerView inside a constraint layout and I cannot make it scroll, the list just continues below the screen without scroll possibility. If I turn the layout into relative layout the scroll works fine. how can I get it to scroll? the the…
38
votes
2 answers

nested scrollview + recyclerview, strange autoscroll behaviour

In a view pager I have several fragments, one of them uses a nested scrollview with a header and a recyclerview :
Renaud Favier
  • 1,645
  • 1
  • 17
  • 33
38
votes
2 answers

RecyclerView GridLayoutManager with full width header

I'm using a very helpful example here to show a RecyclerView and a GridLayoutManager to show a grid with a header. It looks pretty good, but my graphic designer wants the header item to take up the full width of the RecyclerView. Right now there is…
Kibi
  • 1,860
  • 1
  • 29
  • 39