I dont think that its possible to add a footer to an empty ListView
. Though ListView
can use an empty View
which can is displayed when there are no items in the ListView
. now there are 2 ways to do this:
1:
RelativeLayout empty = (RelativeLayout) getLayoutInflater().inflate(
R.layout.empty_view,
null);
((ViewGroup)list.getParent()).addView(empty);
list.setAdapter(adapter);
2:
RelativeLayout empty = (RelativeLayout) getLayoutInflater().inflate(
R.layout.empty_view,
(ViewGroup) list.getParent());
list.setEmptyView(empty);
here empty
is of type View
so it can be a LinearLayout
or RelativeLayout
which can be inflated using LayoutInflater
during runtime.
NOTE: make sure you set the adapter after adding the empty view.
Hope it helps.