我如何使用kotlin作为以下Java代码将layoutmanager设置为RecycleView:
mRecyclerView.setLayoutManager(mLinearLayoutManager);
最佳答案
接下来的两行将方向设置为垂直
mRecyclerView.layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL ,false)
或者
mRecyclerView.layoutManager = LinearLayoutManager(this)
mRecyclerView.layoutManager = LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL ,false)
设置水平方向
要设置网格布局,
mRecyclerView.layoutManager = GridLayoutManager(this, spanCount)