I am new to android development and I came across these 3 different options ListView, AbsListView and RecyclerView to create a List in android. What is the difference between these 3.
First, AbsListView is an abstract class and can't be used as a View element in application layout, although you can use it as a Base Class to implement your own View . Before Lollipop, there wasn't RecyclerView , it was introduced as a part of Material Design. It introduced a new way of handling listeners.
RecyclerView is a ViewGroup that contains Views corresponding to your data. It itself a View so, it is added to the layout file as any other UI element is added. ViewHolder Object is used to define each individual element in the list. View holder does not contain anything when it created, RecyclerView binds data to it.
In the practical on scrolling views, you use ScrollView to scroll a View or ViewGroup . ScrollView is easy to use, but it's not recommended for long, scrollable lists. RecyclerView is a subclass of ViewGroup and is a more resource-efficient way to display scrollable lists.
First, AbsListView
is an abstract class and can't be used as a View
element in application layout, although you can use it as a Base Class
to implement your own View
.
Before Lollipop, there wasn’t RecyclerView
, it was introduced as a part of Material Design. It introduced a new way of handling listeners.
You can read more in-depth explanation Here
Starting from Lollipop it is considered as good practice to use RecyclerView
instead of deprecated ListView
.
You can read how to use RecyclerView
at official android documentation given by google or use this great tutorial.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With