Create default message on empty fragment

时间:2015-06-22 10:43:11

标签: android android-fragments android-studio

I have two fragments in my app which both contains a listview. The first fragment is meant to hold user entries(text based notes), user has an option of setting reminders to these notes so they can be notified. This is where the second fragment comes in. By swipping right, user can see a list of their notes with reminder set for them in a listview. Question is when there are no set reminders (meaning, nothing to show in the reminder fragment) I want to be able to show a default message at the centre of the screen instead of having a blank page. Unfortunately, I can't add image to this post as I'm new to stackoverflow and don't have enough reputation yet. Please see this link for a description of what I intend to implement.

https://www.dropbox.com/s/ilu2aixe99sap9f/Screenshot_2015-06-12-19-54-06.png?dl=0

中提取特定网址

编辑:我正在为listview使用自定义适配器,该适配器正在填充来自数据库的信息。

1 个答案:

答案 0 :(得分:1)

您要做的是在列表视图中添加一个空视图,如下所示: Showing empty view when ListView is empty