recyclerview No adapter attached; skipping layout

后端 未结 30 3727
走了就别回头了
走了就别回头了 2020-11-21 04:51

Just implemented RecyclerView in my code, replacing ListView.

Everything works fine. The data is displayed.

But error messages are

30条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-21 05:19

    This happens because the actual inflated layout is different from that which is being referred by you while finding the recyclerView. By default when you create the fragment, the onCreateView method appears as follows: return inflater.inflate(R.layout.,container.false);

    Instead of that, separately create the view and use that to refer to recyclerView View view= inflater.inflate(R.layout.,container.false); recyclerview=view.findViewById(R.id.); return view;

提交回复
热议问题