public static void setLinearLayout(Context context, RecyclerView recyclerView){
recyclerView.setLayoutManager(new LinearLayoutManager(context));
}
public static void setGridLayout(Context context,RecyclerView recyclerView,int column){
recyclerView.setLayoutManager(new GridLayoutManager(context,column));
}
//direction: horizontal 0 vertical 1
public static void setStaggeredLayout(RecyclerView recyclerView,int column, int direction){
recyclerView.setLayoutManager(new StaggeredGridLayoutManager(column,direction));
}
RecyclerView布局管理
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 很多 App 都被设计了分组列表有粘性条目的效果,而现在我们开发安卓,基本都用上了RecyclerView,这里介...
- RecyclerView常用的布局管理器有三种,分别是LayoutManager、GridLayoutManage...
- LayoutManager是一个抽象类,有3个子类: LinearLayoutManager: 线性布局管理器 G...
- LayoutManager是一个抽象类,有3个子类: LinearLayoutManager: 线性布局管理器 G...