我只是想实现部分在交错GridView。如今天,昨天和其他。 我已经尝试了下面的库,但我没有运气。如何实现交错GridView的部分?
- RecyclerView与StaggeredGridLayoutManager。
你可以给出一些关于如何实现的建议吗?
我只是想实现部分在交错GridView。如今天,昨天和其他。 我已经尝试了下面的库,但我没有运气。如何实现交错GridView的部分?
你可以给出一些关于如何实现的建议吗?
我已经通过使用RecyclerView和StaggeredGridLayoutManger在SimpleAdapter.java中实现了此功能。
if (position % 5 == 0) {
StaggeredGridLayoutManager.LayoutParams layoutParams = (StaggeredGridLayoutManager.LayoutParams) holder.itemView.getLayoutParams();
layoutParams.setFullSpan(true);
} else {
StaggeredGridLayoutManager.LayoutParams layoutParams = (StaggeredGridLayoutManager.LayoutParams) holder.itemView.getLayoutParams();
layoutParams.setFullSpan(false);
}
这里是我创造了这个StaggeredGridViewSections
您可以将StaggeredGridLayoutManager与自定义ItemDecoration一起使用。
这是一个使用LinearLayoutManager进行处理的库, sticky-headers-recyclerview。您可能可以根据自己的需求调整它,或者至少了解如何去做。
演示如果您不需要RecycleView的链接,这是另一种选择:https://github.com/sarahlensing/StaggeredGridView
您可以使用StaggeredGridLayoutManager一个适配器和集两个ItemViewTypes 以及截面视图将full span设置为true。
StaggeredGridLayoutManager.LayoutParams layoutParams = (StaggeredGridLayoutManager.LayoutParams) holder.itemView.getLayoutParams();
layoutParams.setFullSpan(true);
指定您正在面临的问题或您想要通过某些代码或屏幕截图实现的目标。 – Harry
如果您已经尝试过,然后发布这些代码,并提及问题/细节! –
问题在https://github.com/etsy/AndroidStaggeredGrid/issues/166中提出 –