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
199
votes
12 answers

match_parent width does not work in RecyclerView

My RecyclerView and item has match_parent width but the result is :
abbasalim
  • 3,118
  • 2
  • 23
  • 45
193
votes
29 answers

How to scroll to the bottom of a RecyclerView? scrollToPosition doesn't work

I'd like to scroll to the bottom of the RecyclerView list after loading the activity. GENERIC_MESSAGE_LIST = (ArrayList) intent.getExtras().getParcelableArrayList(ConversationsAdapter.EXTRA_MESSAGE); conversationView = (RecyclerView)…
waylaidwanderer
  • 2,051
  • 2
  • 15
  • 9
192
votes
18 answers

Recyclerview inside ScrollView not scrolling smoothly

For my app I am using a RecyclerView inside a ScrollView where the RecyclerView has a height based on its content using this library. Scrolling is working but it's not working smoothly when I scroll over the RecyclerView. When I scroll over the…
191
votes
9 answers

CardView background color always white

I use RecyclerView with GridLayoutManager and have each item as CardView. Unfortunately, the CardView here does not seem to change its background color. I tried in layout and programmatically as well but I have tried nothing seems to work. I have…
Ishaan
  • 3,658
  • 2
  • 23
  • 39
187
votes
16 answers

RecyclerView - Get view at particular position

I have an activity with a RecyclerView and an ImageView. I am using the RecyclerView to show a list of images horizontally. When I click on an image in the RecyclerView the ImageView in the activity should show a bigger picture of the image. So far…
Vamsi Challa
  • 11,038
  • 31
  • 99
  • 149
185
votes
11 answers

Understanding RecyclerView setHasFixedSize

I'm having some trouble understanding setHasFixedSize(). I know that it is used for optimization when the size of RecyclerView doesn't change, from the docs. What does that mean though? In most common cases a ListView almost always has a fixed size.…
SIr Codealot
  • 5,331
  • 9
  • 33
  • 45
184
votes
15 answers

Nested Recycler view height doesn't wrap its content

I have an application that manage collections of books (like playlists). I want to display a list of collection with a vertical RecyclerView and inside each row, a list of book in an horizontal RecyclerView. When i set the layout_height of the inner…
181
votes
16 answers

How to properly highlight selected item on RecyclerView?

I am trying to use a RecyclerView as a horizontal ListView. I am trying to figure out how to highlight the selected item. When I click on one of the items, it gets selected and it is highlighted properly but when I click on another one, the second…
user65721
  • 2,833
  • 3
  • 19
  • 28
178
votes
13 answers

RecyclerView expand/collapse items

I want to expand/collapse the items of my recyclerView in order to show more info. I want to achieve the same effect of the SlideExpandableListView. Basically in my viewHolder I have a view that is not visible and I want to do a smooth…
stanete
  • 4,062
  • 9
  • 21
  • 30
174
votes
14 answers

RecyclerView - How to smooth scroll to top of item on a certain position?

On a RecyclerView, I am able to suddenly scroll to the top of a selected item by using: ((LinearLayoutManager) recyclerView.getLayoutManager()).scrollToPositionWithOffset(position, 0); However, this abruptly moves the item to the top position. I…
170
votes
10 answers

Margin/padding in last Child in RecyclerView

I'm trying to add Padding/Margin Bottom in the last row and Padding/Margin Top in the first row. I can not do it in the item xml as it would affect all of my Children. I have headers and children in my RecyclerView Adapter so I can not use the …
RedEagle
  • 2,358
  • 3
  • 13
  • 18
170
votes
2 answers

Remove RecyclerView scroll effects

I have two RecyclerView inside my NavigationDrawer. Both have the blue scroll effects. How can I remove this effect in both RecyclerViews? I tried changing: mRecyclerView.setHasFixedSize(true); to false, but it remove scroll effects. (What is the…
JavierSegoviaCordoba
  • 6,531
  • 9
  • 37
  • 51
170
votes
20 answers

Android RecyclerView addition & removal of items

I have a RecyclerView with an TextView text box and a cross button ImageView. I have a button outside of the recyclerview that makes the cross button ImageView visible / gone. I'm looking to remove an item from the recylerview, when that items cross…
163
votes
11 answers

How can I make sticky headers in RecyclerView? (Without external lib)

I want to fix my header views in the top of the screen like in the image below and without using external libraries. In my case, I don't want to do it alphabetically. I have two different types of views (Header and normal). I only want to fix to…
Jaume Colom
  • 1,701
  • 3
  • 11
  • 6
156
votes
7 answers

Android Recyclerview vs ListView with Viewholder

I recently came across the android RecyclerView which was released with Android 5.0 and it seems that RecyclerView is just an encapsulated traditional ListView with the ViewHolder pattern incorporated into it, which promotes the reuse of the view,…
Mushtaq Jameel
  • 7,053
  • 7
  • 33
  • 52