Pokaż TextView dla pustego ListView wewnątrz ramki FrameLayout

Mam układ z kartami i działanie z użyciem kart jako widoków. Ma trzy karty jakoListViews. Jeśli którakolwiek z list jest pusta, chcę pokazać prostąTextView zamiast. Przeszedłem przez wiele postów, ale wszyscy mówią o singluListView wewnątrz aLinearLayout. Nie jestem pewien, czy nie działa z powodu wieluListViews lubFrameLayout. Czy nie możemy ustawićvisibility = GONE wewnątrz aFrameLayout? Bo nawet wtedyTextView jest zawsze wyświetlany razem zListView. Czy ktoś może zasugerować, co można zrobić w tym scenariuszu?

Próbowałem również w tymTextView w innym pliku xml. Ale nie wiem, jak to dodaćTextView do mojegoFrameLayout.

To właśnie robię dla wszystkich trzechListViews

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.setAdapter(new ArrayAdapter<String>(this, R.layout.listview_row,TopWR));
} else {
  frameLayout.addView(empty);
}

FrameLayout

<FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"        
        android:background="@drawable/innerdashboard_bg"
        android:layout_weight="1">


            <ListView 
            android:id="@+id/Top_10"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:paddingRight="5dp" 
            android:text="this is a tab" />


        <ListView 
            android:id="@+id/Billable"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" 
            android:paddingRight="5dp" 
            android:text="this is another tab" />


        <ListView
            android:id="@+id/Product"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" 
            android:paddingRight="5dp"
            android:textSize="14sp"
            android:text="this is a third tab" />

 </FrameLayout>

Widok tekstu

<TextView  xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/blank"
            android:gravity="center"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="No records Avaible"
            android:textColor="#ffffff" />

EDYTOWAĆ

Próbowałem również użyćsetEmptyView, dla wszystkich trzechListViews przy użyciu oddzielnych pustych widoków nie działa!

TextView empty1 = (TextView) findViewById(R.id.blank1);
mListView_top10 = (ListView)findViewById(R.id.Top_10);
mListView_top10.setEmptyView(empty1);
mListView_top10.setAdapter(new ArrayAdapter<String>(this, R.layout.listview_row,TopWR));

xml:

<FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/innerdashboard_bg"
        android:layout_weight="1">


        <LinearLayout 
            android:id="@+id/Top_10"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">

            <ListView 
            android:id="@+id/Top_10"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:paddingRight="5dp" 
            android:text="this is a tab" />

            <TextView  
            android:id="@+id/blank1"
            android:gravity="center"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="No records Avaible"
            android:textColor="#ffffff" />

        </LinearLayout>


        <LinearLayout 
            android:id="@+id/Billable"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">

        <ListView 
            android:id="@+id/Billable"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" 
            android:paddingRight="5dp" 
            android:text="this is another tab" />

        <TextView  
            android:id="@+id/blank2"
            android:gravity="center"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="No records Avaible"
            android:textColor="#ffffff" />

        </LinearLayout>

        <LinearLayout 
            android:id="@+id/Product"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">

        <ListView
            android:id="@+id/Product"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" 
            android:paddingRight="5dp"
            android:textSize="14sp"
            android:text="this is a third tab" />

        <TextView  
            android:id="@+id/blank3"
            android:gravity="center"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="No records Avaible"
            android:textColor="#ffffff" />

        </LinearLayout>

</FrameLayout>

questionAnswers(4)

yourAnswerToTheQuestion