本文主要是介绍recyclerview——留作以后便于查找,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
recyclerview一共有三中布局管理器
1:.linearlayoutManager(ListView)
2.gridLayoutManager(GridView)
3.staggredGridLayoutManager(瀑布流)
用法(与上边对应)
1.
<span style="font-family:KaiTi_GB2312;font-size:18px;">//创建线性布局
mLayoutManager = new LinearLayoutManager(this);
//垂直方向
mLayoutManager.setOrientation(OrientationHelper.VERTICAL);
//给RecyclerView设置布局管理器
recyclerView_one.setLayoutManager(mLayoutManager);</span>
2.
<span style="font-family:KaiTi_GB2312;font-size:18px;">GridLayoutManager girdLayoutManager=new GridLayoutManager(this,4);recyclerView_one.setLayoutManager(girdLayoutManager);</span>
3.
<span style="font-family:KaiTi_GB2312;font-size:18px;">StaggeredGridLayoutManager staggeredGridLayoutManager=new StaggeredGridLayoutManager(2,OrientationHelper.VERTICAL);recyclerView_one.setLayoutManager(staggeredGridLayoutManager);</span>
这篇关于recyclerview——留作以后便于查找的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!