Recyclerview not call any Adapter method :onCreateViewHolder,onBindViewHolder,

前端 未结 8 1893
灰色年华
灰色年华 2020-12-01 08:54

my RecyclerView do not call onCreateViewHolder, onBindViewHolder, therefore, does not appear nothing in recyclerview. I put logs for debugging, and no log is shown. What can

8条回答
  •  悲哀的现实
    2020-12-01 09:36

    Other than @SanatiSharif's and @sohrab's answer, you have to follow below mandatory step.

    Make sure you call setLayoutManager, something like below.

    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    

    before setting adapter into recyclerView, otherwise it is not going to work. You can customize it if you need. this link will give you some idea of how LayoutManager works.

提交回复
热议问题