Tag: recyclerview

Recyclerview and handling different type of row inflation

I’m trying to work with the new RecyclerView, but I could not find an example of a RecyclerView with different types of rows/cardviews getting inflated. With ListView I override the getViewTypeCount and getItemViewType, for handling different types of rows. Am I supposed to do it like the “old” way or should I do something with […]

Scroll RecyclerView to show selected item on top

I’m looking for a way to scroll a RecyclerView to show the selected item on top. In a ListView I was able to do that by using scrollTo(x,y) and getting the top of the element that need to be centered. Something like: @Override public void onItemClick(View v, int pos){ mylistView.scrollTo(0, v.getTop()); } The problem is […]

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 I when I saw this example picture I got really confused about the difference between the two. The picture above can be easily created by ListView with custom adapter. So, in […]

How do I make WRAP_CONTENT work on a RecyclerView

I have a DialogFragment that contains a RecyclerView (a list of cards). Within this RecyclerView are one or more CardViews that can have any height. I want to give this DialogFragment the correct height based on the CardViews that are contained within. Normally this would be simple, I would set wrap_content on the RecyclerView like […]

Get visible items in RecyclerView

I need to know which elements are currently displayed in my RecyclerView. There is no equivalent to the OnScrollListener.onScroll(…) method on ListViews. I tried to work with View.getGlobalVisibleRect(…), but that hack is too ugly and does not always work too. Someone any ideas?

How to show an empty view with a RecyclerView?

I am used to put an special view inside the layout file as described in the ListActivity documentation to be displayed when there is no data. This view has the id “android:id/empty”. <TextView android:id=”@android:id/empty” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:text=”@string/no_data” /> I wonder how this can be done with the new RecyclerView?

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 I am not really sure where to […]

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 horizontal RecyclerView to 300dp, it is displayed correctly but when i set […]

How to animate RecyclerView items when they appear

How can I animate the RecyclerViews when there are appearing? The default item animator only animates when a data is added or removed after the recycler data has been set. I’m new developing applications, and don’t have any clue where to start. Any ideas how to achieve this?

Should we use RecyclerView to replace ListView?

Android Docs say: The RecyclerView widget is a more advanced and flexible version of ListView. This widget is a container for displaying large data sets 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 […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.