Query regarding displaying data on BaseAdapter
I am displaying a list of items using the BaseAdapter. The data which I am displaying for the BaseAdapter is ArrayList which is properly displayed. When the data is empty , a blank screen is displayed which is perfect. I wanted to show a single text at the middle of the screen which is "No data found" . If I am adding the text "No data found" to the ArrayList when the data is not there , then every list element will display the "No data found" 开发者_开发问答which is not right , since I want a single text on the whole screen.
How can I display the "No data found" at the centre of the screen? I dont want to use any background image to display the data.
Thanks in advance.
Warm Regards,
CB
Take a look at ListView's setEmptyView.
Also, you can add a view with id "@android:id/empty" that will be shown instead of the ListView when the list is empty. Make sure you are using a ListActivity.
精彩评论