setEmptyView on ListView not showing its view in a android app?

前端 未结 12 948
自闭症患者
自闭症患者 2020-12-02 18:37

I have a problem with the setEmptyView method from a ListView.

Here is my Java code:

ListView view = (ListView)findViewById(R.id.listView1);
view.se         


        
12条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-02 19:14

    Create a layout in XML that specifies both the ListView and the empty view you want to use. If you give them IDs of @android:id/list and @android:id/empty, android will automatically use the view with id:empty when list is empty.

提交回复
热议问题