Рет қаралды 41,537
🚀 Android & Kotlin Masterclass - Become a serious Android app developer with our best-selling masterclass: bit.ly/3PaKdhS
In this Android RecyclerView Tutorial, you will learn everything you need to know about RecyclerViews.
We have also created an article on our blog, going over this in more depth. Here you can also download the code for this video.
tutorials.eu/a...
You will learn about RecyclerViews but also about how to use different ViewTypes and how to customize your list items using XML.
Working with RecyclerView in Kotlin
RecyclerViews in Android, are one of the most interesting concepts to become a master in Android. There’s a lot of different examples and implementations across the internet. Learn first, what a RecyclerView is before implementing it.
What is a RecyclerView?
A RecyclerView is a flexible view for providing a limited window into a large data set. It is essentially a ViewGroup of containers called ViewHolders which populate a particular item. RecyclerView is an extensive Android class to provide a flexible UI. A great benefit of using RecyclerViews is that you’re able to efficiently reuse views instead of managing items that aren’t even visible to a user.
Why we use RecyclerView?
In the past Android used to use ListView or GridView classes for displaying lists. The RecyclerView can be thought of as a combination of a ListView and a GridView. However, in a RecyclerView, there are features that separate your code into maintainable components while also enforcing memory-efficient design patterns.
How is it be better than ListViews and GridViews?
ListViews and GridViews are comparatively slower than RecyclerViews.
Layouts in RecyclerView
The RecyclerView changed everything which was used in the ListView and GridView. RecyclerView still uses an Adapter to act as a data source. However, you have to create ViewHolders to keep references in memory.
To provide a new view, RecyclerView either creates a new ViewHolder object to inflate the layout and hold those references, or it recycles one from the existing stack.
This is it why it’s called a RecyclerView!
The Views in RecyclerView comes with default animations that you don’t have to create or add yourself.
RecyclerView requires a ViewHolder, the RecyclerView knows which animation to apply to which item and adds them as required. You can also create your own animations and apply them as needed.
The most important and interesting component of a RecyclerView is its LayoutManager. This object positions the RecyclerView’s items and tells them when to recycle items that have transitioned off-screen. The ListView used to do this work by itself.
The RecyclerView has broken out of this functionality to allow for different kinds of layouts: Vertical, Horizontal, Grid, Staggered, or your own!
There are three types of Layout Managers by default:
LinearLayoutManager: Positions items to look like a standard ListView.
GridLayoutManager: Positions items in a grid format similar to a GridView.
StaggeredGridLayoutManager: Positions terms in a staggered grid format.
RecyclerView implementations require:
A list of data objects to work with.
An XML file of the view item.
An adapter to bind that data to the views.
A ViewHolder to populate the UI view from the XML item file.
Now we are familiar with what RecyclerView is and its basics, let’s get into the implementation.
About this Video:
You learn how to use RecyclerViews in Kotlin. This is important for Android App Development. This Android RececlyerViews Tutorials is the only one you will ever need. RecyclerView Android is generally used by most of the important Apps out there. We are going to build RecyclerView Android Studio. As in this tool it is best to create Android Apps. RecyclerView Adapters are also important, when it comes to making a ListView kind of thing. Basically we are going to make an Android ListView and an Android GridView. Therefore we are going to use the Android LayoutManager.
tutorialsEU offers you free video tutorials about programming and development for complete beginners up to experienced programmers.
This includes C#, Unity, Python, Android, Kotlin, Machine Learning, etc.
Stay tuned and subscribe to tutorialsEU: goo.gl/rBFh3x