Display empty groups

2 posts, 0 answers
  1. Tracy
    Tracy avatar
    12 posts
    Member since:
    Aug 2014

    Posted 23 Dec 2016 Link to this post

    How can I display empty groups?

    For example, I am listing appointments each day for a week (i.e. Sunday to Saturday); but if there are no events for a particular day, I still want to show that group.

  2. Todor
    Todor avatar
    793 posts

    Posted 28 Dec 2016 Link to this post

    Hello Tracy,

    Thank you for your question.

    The groups are based on the items that you have, so if you don't have items in a group, such group will not be created. You can workaround this, by creating a Dummy appointment item for each day, this way you will have items for each group that you want to create. The easiest way not to show this item among the actual items would be to set the itemView's visibility to GONE in your adapter's onBindViewHolder when the item to be bound is a dummy item and set it to VISIBLE otherwise. You can also have another item view type for your dummy items if you would prefer.

    I hope this information helps.

    Telerik by Progress
    Want to go cross-platform with C# for iOS, Android, and UWP. With UI for Xamarin you can creating beautiful apps for these mobile platforms using a single shared C# codebase.
Back to Top