java.lang.IllegalStateException: RecyclerView has no LayoutManager in Fragment

后端 未结 5 1618
庸人自扰
庸人自扰 2020-12-30 06:50

I was in the process of changing an Activity into a Fragment and got the following error as soon as I inflated the RecyclerView.

@Override
public View onCrea         


        
5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-30 06:57

    I had same issue when I tried to use android-parallax-recycleview.

    The solution was simple, you can create the layout manager manager manually.

    Code snippet from example-parallaxrecycler:

    LinearLayoutManager manager = new LinearLayoutManager(this);
    manager.setOrientation(LinearLayoutManager.VERTICAL);
    myRecycler.setLayoutManager(manager);
    

提交回复
热议问题