Android: Recycle View - JamesDansie/data-structures-and-algorithms GitHub Wiki

Recycle View

Author: James Dansie

Recycle views are used for scrolling lists of data (think of your email inbox with lots of repeating scrolling elements). Recycle views can also be scrolling lists of cards, instead of individual elements, this is called CardView.

To hook up a recycle view;

  1. Grab the view
recyclerView = (RecyclerView) findViewById(R.id.my_recycler_view);
  1. Set the layout manager
layoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(layoutManager);
  1. Set the adapter
mAdapter = new MyAdapter(myDataset);
recyclerView.setAdapter(mAdapter);

References