Show TextView for an empty ListView inside a FrameLayout

前端 未结 4 1889
我寻月下人不归
我寻月下人不归 2021-01-28 09:18

I have a tabbed layout and an activity using tabs as views. It has three tabs as ListViews. If either of the lists is empty I want to show a simple TextView

4条回答
  •  醉话见心
    2021-01-28 09:29

    Have you tried setting the Visibility on each of the ListViews in your java code?

    TextView empty = (TextView) findViewById(R.id.blank);
    FrameLayout frameLayout = (FrameLayout) findViewById(android.R.id.tabcontent);
    
    
    mListView_top10 = (ListView)findViewById(R.id.Top_10);
          if(TopWR.size()!=0) {
              mListView_top10.setVisibility(View.VISIBLE);
              mListView_top10.setAdapter(new ArrayAdapter(this,
                        R.layout.listview_row,TopWR));
    
    
          }
          else {
              mListView_top10.setVisibility(View.GONE);
              empty.setVisibility(View.VISIBLE);
              frameLayout.addView(empty);
    
          }
    

    TextView

    
    

提交回复
热议问题