Skip to content

Latest commit

 

History

History
29 lines (17 loc) · 879 Bytes

401-28.md

File metadata and controls

29 lines (17 loc) · 879 Bytes
layout title permalink
page
401.28 Reading Notes
/401-R28/

RecyclerView

Overview of RecyclerView

  • Within an activity, RecyclerView is an element in a layout that binds to other elements to reuse existing views rather than removing and creating them as displayed elements change.

Layout Types

  • LinearLayoutManager: 1-d list

  • GridLayoutManager : 2-d grid with standardized dimensions depending on arrangement axis

  • StaggeredLayoutManager : 2-d offset view without standardized dimensions

Implementation

  • The key classes used with RecyclerView are ViewHolder and Adapter. Overriding several methods is necessary for proper functionality:

    • onCreateViewHolder(): used for creation of views

    • onBindViewHolder(): used for replacing views' contents in the layout

    • getItemCount(): used for assessing data set sizes