1 .If viewholder not used then Listview
1.1 Shows laggy Results i.e delayed response.
1.2 Major issue raised was finding views by IDs every time.
but this problem is solved in RecyclerView using RecyclerView.ViewHolder.
When implementing the adapter for RecyclerView, providing a ViewHolder is compulsory. So all above issues are not faced
2. Layout Manager
In ListView We can just implement vertical scroll according to its documentation.But recyclerView supports horizontal as well vertical scroll.
RecyclerView supports different lists which is implemented via RecyclerView.LayoutManager class.
ViewHolder : Recycling of views is managed by ViewHolder Class by holding references to all views in a separate view.So it help recyclerview work in a better optimized way.
RecyclerView.LayoutManager class for RecyclerView are :
LinearLayoutManager : to create both horizontal and vertical scroll lists.
StaggeredGridLayoutManager : to create staggered lists.
GridLayoutManager : to display grids like view, like any image gallery or etc.
3. Item Animator
We can not apply custom animations to listview items but recyclerView provides that facility.And can use RecyclerView.ItemAnimator class for handling animations.
We can apply custom animations on item addition, deletion and move events.by default DefaultItemAnimator is used by android in case of recyclerview if we don't implement any custom animations.
4. OnItemTouchListener : A new addition as well. In Listview we implemented OnItemClickListener in order to get item clicked. But in recyclerView, RecyclerView.OnItemTouchListener is there which is an interface that help us detect touch events in Android RecyclerView.So we can get gestures easily.
RecyclerView is available in older SDK as support is provided in v7 lib.
So I think we need to use RecyclerView as its new and will provide many customization, And will provide more in upcoming future.
So I think we need to use RecyclerView as its new and will provide many customization, And will provide more in upcoming future.
No comments:
Post a Comment