

tLayoutManager(new GridLayoutManager(this, 2))

MRecyclerView = (RecyclerView) findViewById(R.id.my_recycler_view) Reuses cells while scrolling up/down : this is possible with implementing View Holder in the ListView adapter, but it was an optional thing, while in the RecycleView it's the default way of writing adapter.ĭecouples list from its container : so you can put list items easily at run time in the different containers (linearLayout, gridLayout) with setting LayoutManager. RecyclerView was created as a ListView improvement, so yes, you can create an attached list with ListView control, but using RecyclerView is easier as it: Iii) GridLayoutManager - which supports displaying grids as seen in Gallery apps.Īnd the best thing is that we can do all these dynamically as we want.

Ii) StaggeredLayoutManager - which supports Pinterest like staggered lists, I) LinearLayoutManager - which supports both vertical and horizontal lists, There is more about RecyclerView, but I think these points are the main ones. tLayoutManager( new GridLayoutManager( this, 3)) Īnimations are decoupled and delegated to ItemAnimator. tLayoutManager( new GridLayoutManager( this, 2)) tLayoutManager( new LinearLayoutManager( this)) Reuses cells while scrolling up/down - this is possible with implementing View Holder in the listView adapter, but it was an optional thing, while in the RecycleView it's the default way of writing adapter.ĭecouples list from its container - so you can put list items easily at run time in the different containers (linearLayout, gridLayout) with setting LayoutManager.Įxample: mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view)
