Create a list with RecyclerView in Kotlin

Lists are the most common ways of representing collections of similar data . Thus a RecyclerView is a widget that we Android developers have to deal with very frequently . Following are the steps involved in implementing a RecyclerView . In this tutorial we shall implement the recyclerview using Kotlin.

1. Add the recyclerview dependency in the app level build.gradle
2. Create a data class to hold information of each post
3. Add RecycerView widget to the layout
4. Create the RecyclerView adapter
5. Access and set up the RecyclerView from the Activity
6. Handle click action on the list items

1. Add the recyclerview dependency in the app level build.gradle
compile ‘com.android.support:recyclerview-v7:27.0.2’

2. Create a data class to hold information of each post

3. We have a prety simple layout as shown below .

4. Create the RecyclerView adapter

5. Access and set up the RecyclerView from the Activity

6. Handle click action on the list items

Leave a Reply

Your email address will not be published. Required fields are marked *