I want to create a RecyclerView (or any other view for that matter) that can have a LinearLayoutManager at first and then expand all of it to a GridLayoutManager. Something like the first part of this.
Asked
Active
Viewed 136 times
-1
-
GridLayout manager with 1 column/row is the same as LinearLayout manager. So you are doing this the wrong way, do it with GridLayoutManager with one column/row and then increase the number if you need it. – Bojan Kseneman Nov 28 '16 at 18:37
-
@BojanKseneman okay thanks! But how should I handle swiping to move the items in place from 1 column/row to 3/3. – Alex Newman Nov 28 '16 at 18:50
-
https://medium.com/@ipaulpro/drag-and-swipe-with-recyclerview-b9456d2b1aaf#.qfd0olo7a – Bojan Kseneman Nov 28 '16 at 20:09
-
https://medium.com/@ipaulpro/drag-and-swipe-with-recyclerview-6a6f0c422efd#.v6eovsi12 – Bojan Kseneman Nov 28 '16 at 20:09
1 Answers
0
This is something you'll need to write yourself. For example, have a show list/grid icon in toolbar which triggered re-rendering of RecyclerView (using either LinearLayoutManager
or GridLayoutManager
as appropriate). You could then have your RecyclerView.Adapter
constructor have a flag indicating which to use (and switch between different ViewHolder
implementations in your onCreateViewHolder
method)

John O'Reilly
- 10,000
- 4
- 41
- 63
-
True but I don't know how handle swiping in a LayoutManager. Also I found https://github.com/android/platform_frameworks_base/blob/master/packages/SystemUI/src/com/android/systemui/qs/PseudoGridView.java – Alex Newman Nov 28 '16 at 18:19