Add RecyclerView control to Android studio in

RecyclerView: after Android5.0 is provided for displaying the control of large amounts of data within a limited range of the window.

Compared with the ListView, RecyclerView advantages are: 

  • Showing the effect of: RecyclerView control list of effects can be achieved by lateral or vertical LayoutManager class GridView cascade effect and effect, and can achieve a list ListView control effect vertical. 

  • Adapter: RecyclerView controls using RecyclerView.Adapter adapter, the adapter will BaseAdapter in getView () method split onCreateViewHolder () method and onBindViewHolder () method, mandatory use ViewHolder class, the coding standardization, avoiding the beginner to write poor performance of the code.

Compared with the ListView, RecyclerView advantages are:

  • Multiplexing effect: RecyclerView controls Item object reuse work implemented by the control themselves, and ListView control Item object reuse work needs to be operated by the developer convertView of setTag () method and getTag () method. 

  • Animation: RecyclerView controls can setItemAnimator () method animate Item, and not by the ListView control method to animate Item

 

RecyclerView below explain how to add controls to Android Studio

1. Right-click the project item in the menu selection to open the "open Module Settings (Open Module Settings)" dialog box.

2, select "the Dependencies (dependent), select App, click in the above" + ", and then select the" Library dependency (dependent libraries). "

3, find the "recyclerview-v7" in the words of the dependent library open, select and then click ok, then Android studio of Gradle reloads After loading can be directly used RecyclerView up.

 

Published 40 original articles · won praise 2 · Views 5162

Guess you like

Origin blog.csdn.net/Dnesity/article/details/104761304