SetEmptyView has no effect on the setemptyview of ListView.
When using listView or gridView, when the list is empty, sometimes a special empty view needs to be displayed to prompt the user. In general, If you inherit the ListActivity, as long
TextView TV = new TextView (this); TV. setText ("this is a empty view") setEmptyView (TV );
However, this method is useless after running. I found this method through google.
TextView emptyView = new TextView (context); emptyView. setLayoutParams (new LayoutParams (LayoutParams. FILL_PARENT, LayoutParams. FILL_PARENT); emptyView. setText ("This appears when the list is empty"); emptyView. setVisibility (View. GONE); (ViewGroup) list. getParent ()). addView (emptyView); list. setEmptyView (emptyView );
Then OK.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.