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

前端 未结 12 945
自闭症患者
自闭症患者 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:15

    the problem is, i have to do a addContentView:

    View empty = getLayoutInflater().inflate(R.layout.empty_list_item, null, false);
    addContentView(empty, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    view.setEmptyView(empty);
    

    now its fine

提交回复
热议问题