2020-03-23

①添加依赖(implementation 'com.android.support:recyclerview-v7:29.0.2')

②创建布局(宽、高必须充满)

③找控件

④设置布局管理器(线性布局,网格布局和瀑布流)

⑤获取数据(切换子线程的方法)

⑥创建适配器——重写三个方法,通过接口回调实现点击事件

⑦设置适配器

布局管理器

//线性布局

rv.setLayoutManager(new LinearLayoutManager(this));

//网格布局

rv.setLayoutManager(new GridLayoutManager(this, 3));

//瀑布流

rv.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL)

链接:https://www.jianshu.com/p/a64915446072

來源:

著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

你可能感兴趣的:(2020-03-23)