简体   繁体   English

回收站视图滚动

[英]Recycler View Scrolling

Is there a way that I could scroll a row vertically and horizontally in a RecyclerView. 有没有一种方法可以在RecyclerView中垂直和水平滚动行。

I use this code but I only scroll vertically. 我使用此代码,但仅垂直滚动。

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

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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM