Equivalent of ListView.setEmptyView in RecyclerView

前端 未结 13 1677
孤街浪徒
孤街浪徒 2020-11-30 17:44

In RecyclerView, I want to set an empty view to be shown when the adapter is empty. Is there an equivalent of ListView.setEmptyView()?

13条回答
  •  萌比男神i
    2020-11-30 18:13

    From my point of view the easiest way how to do an empty View is to create new empty RecyclerView with layout you want to inflate as a background. And this empty Adapter is set when you check your dataset size.

提交回复
热议问题