This tutorial is the second part of the RecyclerView tutorial series.
If you don’t know how to use RecyclerView or you need to refresh your knowledge, please read this tutorial first:

What will we build in this tutorial?

In this tutorial, we’ll develop a news application that has a RecyclerView with multiple view-types.

Adding dependencies

In addition to the RecyclerView’s dependency, we’ll add the CardView’s dependency, because we want to use it in our items’ layouts. So open the build.gradle file in your app module and add these dependencies to the dependencies section and then click on the Sync Now.

// RecyclerView dependency
implementation "androidx.recyclerview:recyclerview:1.1.0" …


This Tutorial is the first part of the RecyclerView tutorials series. If you know how to create a RecyclerView, how to handle click-events, and how to update it, maybe it’s better to read the second part of this series.

If the scrolling list of elements needs to be displayd based on large datasets, the RecyclerView should be used

The RecyclerView is used in almost all Android applications. The followings are 3 different famous applications that use RecyclerView.

Left to right — 1: Vertical RecyclerView(Gmail) 2: Horizontal RecyclerView(Play Store) 3: Vertical RecyclerView with multiple view type(Medium)

Why using RecyclerView?

You may ask why don’t we use a ScrollView instead of RecyclerView? Imagine you have a list of 1000 items and you want…

Hossein Amini

Senior Android developer at esam.ir

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store