I am trying to set an empty view for three types of list, namely 2 extensible and one kind of list, which are on different tabs:
LayoutInflater inflater = getLayoutInflater();
View emptyView = inflater.inflate(R.layout.empty_view, null, false);
...
ExpListView1.setEmptyView(emptyView);
ListView.setEmptyView(emptyView);
ExpListView2.setEmptyView(emptyView);
This does not work - an empty view is not displayed. Same thing with the code part:
View emptyView = inflater.inflate(R.layout.empty_view, null, false);
View emptyRelativeLayout = (RelativeLayout) emptyView.findViewById(R.id.empty_view_layout);
ExpListView1.setEmptyView(emptyRelativeLayout);
empty_view_layout.xml:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/empty_view_layout">
<TextView
style="@android:style/TextAppearance.Large"
android:id="@+id/empty_view_textview"
android:layout_width = "fill_parent"
android:layout_height="fill_parent"
android:text="@string/no_items_in_list"
android:layout_centerInParent="true"/>
</RelativeLayout>
source
share