Recycler View滚动

时间:2015-09-16 07:46:16

标签: android android-recyclerview

有没有办法可以在RecyclerView中垂直和水平滚动一行。

我使用此代码,但我只是垂直滚动。

LinearLayoutManager layoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(layoutManager);
layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);

1 个答案:

答案 0 :(得分:0)

FOR VERTICAL

LinearLayoutManager layoutManager
            = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
    RecyclerView rvUsers = (RecyclerView) findViewById(R.id.rvUsers);
    rvUsers.setLayoutManager(layoutManager);

FOR HORIZONTAL

LinearLayoutManager layoutManager
                = new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false);
        RecyclerView rvUsers = (RecyclerView) findViewById(R.id.rvUsers);
        rvUsers.setLayoutManager(layoutManager);