Benefit of RecyclerView:
1. Standby the next element for display2. Saves Viewholder scrolled offscreen. Viewholder does not need to be created or have its view inflated; instead, the app just updates the view's contents to match the new item it was bound to.
3. Adapter use RecyclerView.adapter.notifyItemChanged to update changed items by rebinding
Main Objects
1. RecyclerView Object: Overall container for UI that you add to layout.The
RecyclerView
creates only as many view holders as are needed to display the on-screen portion of the dynamic content, plus a few extra. As the user scrolls through the list, the
RecyclerView
takes the off-screen views and rebinds them to the data which is scrolling onto the screen.2. Adapter: manage Viewholder Object (create and bind to data,
onBindViewHolder()
)3. Viewholder Object: view in the list. Display a single item with a view
4. LayoutManager: add Views to RecyclerView
https://developer.android.com/guide/topics/ui/layout/recyclerview
Multiple View per Viewholder
https://stackoverflow.com/questions/26245139/how-to-create-recyclerview-with-multiple-view-type
Comments
Post a Comment