Recyclerview not call onCreateViewHolder

前端 未结 30 1385
离开以前
离开以前 2020-11-28 07:04

My RecyclerView does not call onCreateViewHolder, onBindViewHolder even MenuViewHolder constructor, therefore nothing app

30条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-28 07:43

    This does not apply for your particular case. But this might help someone else.

    This reason could be careless usage of the following method

    recyclerView.setHasFixedSize(true);
    

    If not used with caution, this might cause the onBindView and onCreateViewHolder to not be called at all, with no error in the logs.

提交回复
热议问题