Equivalent of ListView.setEmptyView in RecyclerView

前端 未结 13 1701
孤街浪徒
孤街浪徒 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条回答
  •  甜味超标
    2020-11-30 18:03

    With the new data binding feature you can also achieve this in your layout directly:

    
    

    In that case you just need to add a variable and an import to the data section of your XML:

    
    
    
    
    

提交回复
热议问题