1.28.2016

A Brief Introduction

According to Google Definition a RecyclerView is “A flexible view for providing a limited window into a large data set.” In a while it will replace the commonly used ListView, it can do more than a ListView but only using collaborator classes (usually a LayoutManager and an ItemAnimator)
If you want to increase the ListView performances you must rely on ViewHolder pattern which consists of a simple class that holds the references to the UI components for each row in the ListView (to lean more on how list recycling works, check out this video: https://www.youtube.com/watch?v=-VPM6ICgCk8)

A benefit in using RecyclerView is that it forces you to use the ViewHolder pattern. The ViewHolder design pattern enables you to access each list item view without the need for the look up, saving valuable processor cycles. Specifically, it avoids frequent call of findViewById() during ListView scrolling, and that will make it smooth. A ViewHolder object stores each of the component views inside the tag field of the Layout, so you can immediately access them without the need to look them up repeatedly.


The LayoutManager is responsible for measuring and positioning item views within a RecyclerView as well as determining the policy for when to recycle item views that are no longer visible to the user. By changing the LayoutManager a RecyclerView can be used to implement a standard vertically scrolling list, a uniform grid, staggered grids, horizontally scrolling collections and more

0 comments:

Post a Comment

 
© Copyright 2016 Duckma Blog Theme by Name