RecyclerView is a flexible view for providing a limited window into a large data set.It is a modernized version of the ListView and the GridView classes provided by the Android framework. Recycler view addresses several issues that the existing widgets have.
I assume, you have already download latest Android Studio 3.0 preview, If you have not download , please follow the download an install Android Studio 3.0 Preview, which includes Kotlin support out of the box.
RecyclerView allow to use different layout managers for positioning items. Such as LinearLayout, GridLayout and StaggerLayout. I have developing all there layout and populate data on all the layouts.
Glide used for Image display.
1. First you have to add dependencies on app gradle, following dependencies.
implementation 'com.android.support:recyclerview-v7:25.4.0' compile 'com.github.bumptech.glide:glide:3.5.2'
2. We must have to make add recyclerview on layout file .
3. Now we have to declear Pojo class in kotlin, which is more easy and simple
4. Create simple data using through object in kotlin.
5. Now, we have make MovieAdapter in Kotlin is simple, which is more complex in java.
6. Declear Recycler view and set layout depend you requirement, like Linear, Grid and Stagger.
7. If you want to make divider in your recycler view , then you using RecyclerView.ItemDecoration.
8. Finally, Application ready to run, and then we have get following snapshots.
To get full source code, please download and fork github repository. Download
#HappyCoding #ILoveKotlin