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

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

    Just use,

    View emptyView = getLayoutInflater().inflate(R.layout.empty_view, null);
    ((ViewGroup)listView.getParent()).addView(emptyView);
    

    Instead of listView.setEmptyView(emptyView);

提交回复
热议问题