How to create auto expandable recyclerview? I have a horizontal Recyclerview, I need it to be expand vertically if more child item add into the RecyclerView at run time.
I how set recyclerview param property as horizontal but it is a single line horizontal list. It is not expanding vertically when item become more then the width of the mobile screen..
You generally see Recyclerview as a horizontal list or vertical list. To make it horizontal we set recyclerview param property as linearLayout property. The behavior of Horizontal Recyclerview that can expand vertically is called staging.
So if you want recyclerview expand itself vertical when item reaches at the end of screen width then you have to use staggeredGridLayoutManager. Define you recyclerview as
recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
recyclerView.setLayoutManager(new StaggeredGridLayoutManager(4, StaggeredGridLayoutManager.VERTICAL));
// Here 4 is no. of columns to be displayed