Currently, StaggeredGridLayoutManager
only supports views that span all the columns (for a vertically configured layout), and not an arbitrary number of them.
If you still want to span them across all the columns, you should do this in the adapter implementation:
public final void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
StaggeredGridLayoutManager.LayoutParams layoutParams = (StaggeredGridLayoutManager.LayoutParams) viewHolder.itemView.getLayoutParams();
layoutParams.setFullSpan(true);
}
IMHO, StaggeredGridLayoutManager
is still under heavy development and Google wants us to use it for feedback :(
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…