美文网首页Android
RecyclerView布局管理

RecyclerView布局管理

作者: 明日未期 | 来源:发表于2021-04-28 16:41 被阅读0次
    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布局管理

        本文链接:https://www.haomeiwen.com/subject/nlgvrltx.html