RecyclerView﹕ No adapter attached; skipping layout

前端 未结 3 1001
南旧
南旧 2020-12-03 19:00

I have been reading the different answers here on stackoverflow and on this blog post and tried to implement their solutions but I am still getting the error:

3条回答
  •  生来不讨喜
    2020-12-03 19:43

    You're getting the error because you set the adapter when the data source (photoList) is still empty. and also saying to your recycler view that it's size will not change (by calling setHasFixedSize(true)) but you ARE changing the size of the list in the onCompletion callback of the query. So, remove setHasFixedSize(true) and it should work once you populate the list.

    EDIT: I was wrong, the size in the method has nothing to do with data but with the size of the recycler view itself.

提交回复
热议问题