以下是我设计的布局:
不知道什么原因,即使列表都不是空的,但是视图(在这个案例中是TextView)总是出现空视图。我以为列表会自动检测到什么时候显示空视图。
如何正确检测空视图呢?
elativeLayout android:id="@+id/LinearLayoutAR"
android:layout_height="fill_parent" android:layout_width="fill_parent">
<ListView android:layout_width="fill_parent"
android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ARListView"></ListView>
<ProgressBar android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/arProgressBar"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"></ProgressBar>
<!-- Here is the view to show if the list is emtpy -->
<TextView android:id="@id/android:empty" android:layout_width="match_parent"
android:layout_height="match_parent" android:text="No Results" />
</RelativeLayout>