简体   繁体   中英

Recycler View Scrolling

Is there a way that I could scroll a row vertically and horizontally in a 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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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