Answer the question
In order to leave comments, you need to log in
How to make first item in RecyclerView+StaggeredGridLayoutManager full screen width?
There is a RecyclerView with a StaggeredGridLayoutManager connected to it to display items in two columns. How to achieve that the first element is always on top and takes up all the space horizontally?
Answer the question
In order to leave comments, you need to log in
private View createLayoutParams(View targetView) {
StaggeredGridLayoutManager.LayoutParams params;
params = new StaggeredGridLayoutManager.LayoutParams(StaggeredGridLayoutManager.LayoutParams.MATCH_PARENT, StaggeredGridLayoutManager.LayoutParams.WRAP_CONTENT);
params.setFullSpan(true);
targetView.setLayoutParams(params);
return targetView;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question