(Actually, RecyclerView.ItemAnimator handles these animations.) However, with the increased maturity of the android platform and the material design obsession with aesthetics and animations, RecyclerView, by default, animates adding and removing list items. Animating removal and/or insertion of new items is not designed into ListView. RecyclerView forces usage of this pattern. While the ListView encourages the use of this pattern, it did not require it, and so, developers could ignore the ViewHolder pattern and create a new View every time. The ViewHolder pattern holds Views in a cache, when created, and reuses Views from this cache as needed. The ViewHolder pattern is not enforced by ListView.Items in a ListView can be arranged, displayed and scrolled in a vertical list only, whereas RecyclerView’s LayoutManager can create both vertical and horizontal lists (and diagonal lists if you care to implement that). Only vertical scrolling is allowed in ListView.This might seem intuitively correct, however it is more work for the ListView, compared to the RecyclerView, which requires a LayoutManager. Some of the issues experienced with ListView, which RecyclerView is designed to solve include: The ListView was created in such a way that Views that are no longer needed (possibly when the user has scrolled away) can be reused to display other items in the list as necessary. Since the total number of items in a list can be arbitrarily large, it would be impractical to inflate the layout for each list item immediately the ListView is created. Each item in the list is displayed in an identical manner, and this is achieved by defining a single layout file that is inflated for each list item. The ListView (and RecyclerView) are android widgets that can hold (and display) a collection of items. RecyclerView is a modern, properly planned and more efficient improvement on the ListView.
0 Comments
Leave a Reply. |