Created
September 29, 2020 09:24
-
-
Save rezaiyan/d38543252f0daa15c6cd40972aa70fb7 to your computer and use it in GitHub Desktop.
To have a full width item in the StaggeredGridLayoutManager
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ViewGroup.LayoutParams layoutParams = itemView.getLayoutParams(); | |
if (layoutParams instanceof StaggeredGridLayoutManager.LayoutParams) { | |
if (getAdapterPosition() == 0) { | |
((StaggeredGridLayoutManager.LayoutParams) layoutParams).setFullSpan(true); | |
} else { | |
((StaggeredGridLayoutManager.LayoutParams) layoutParams).setFullSpan(false); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment