How can I fill RecyclerView with GridLayoutManager from right to left

前端 未结 5 577
别那么骄傲
别那么骄傲 2020-11-29 13:06

I\'m trying to fill some data into a RecyclerView with GridLayoutManager:

GridLayoutManager layoutManager = new GridLayoutManager(t         


        
5条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-29 13:45

    There is a better way to do it

    You can programmatically change the layout direction of the RecycleView

    workHourRecycler = view.findViewById(R.id.market_hours_recycler);
    workHourRecycler.setLayoutManager(new GridLayoutManager(getContext(),4));
    
    //Programtically set the direction
    workHourRecycler.setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
    

提交回复
热议问题