Android Horizontal RecyclerView scroll Direction

前端 未结 12 2065
忘掉有多难
忘掉有多难 2020-12-12 16:26

I made a Horizontal RecyclerView and it works fine(thanks to this) but the direction of scroll and data are expand from left to right; then How can I change the RecyclerView

12条回答
  •  醉梦人生
    2020-12-12 16:40

    For changing the direction of swipe you can use

    reverselayout attribute = true.

    In Kotlin,

    val layoutManager = LinearLayoutManager(this@MainActivity,LinearLayoutManager.HORIZONTAL,true)
    recyclerview.layoutManager = layoutManager

    In Java,

     LinearLayoutManager layoutManager = new LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL,true);
     recyclerview.setLayoutManager(layoutManager);
    

    Actually it reverses the layout.

    If it shows like below

    1.2..3....10

    it will change to

    10.9..8....1

    For creating Horizontal RecyclerView there are many ways.

    4 Ways To Create Horizontal RecyclerView In Android

提交回复
热议问题