您好,我可以使用recyclerview布局管理器制作这样的图像吗?这个图像显示我想要做的事先谢谢。
使用ReycyleView
使用GridLayoutManager
manager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
if (position == 0) {
return 2; // Splitting into 2 columns
} else {
return 3; // Splitting into 3 columns
}
}
});
是的你可以...在recycler_adapter
检查position == 0
然后使两个cardsview visible
并设置它们...并在else {cardview4 ,cardview5,cardview6 visible
并设置它们并使cardview1和cardview2 Gone
膨胀布局将包含一个相对lat你与两个horizontal linearlayouts
只是hide make the layouts gone and visible at proper position in onBind()
为了实现这一观点,我认为GridLayoutManager
用它的setSpanSizeLookup()
方法是最好的选择。你可以在this answer找到完整的解释。如果你在实施时遇到任何问题,你可以问。