Reputation: 1865
I have a Listview in my Android app, and I want there to be some horizontal lines when the list is empty to indicate to the user that this is a List. I know that there is the setEmptyView method on ListView, but I'm not sure what to put in that view if I want there to be list rows with horizontal lines. How would I accomplish this?
Upvotes: 0
Views: 192
Reputation: 8734
put the listView in a FrameLayout and add another view in that Frame. if you having any item in the list hide its (visiblity="gone") and show the other view.
OR change your adapter to return multi ViewType in your adapter if you have no item return other type of view
Upvotes: 0
Reputation: 25058
Having a bunch of horizontal lines for an empty list is an iOS convention. If you want your app to fit in with Android better you should set something else. Perhaps notify the user there was an error or that there are no items in the list. You can add this right to your layout.xml file if you're using a ListActivity
. All you need to do is create a view and give it the id @android:id/empty
.
Upvotes: 1