Reputation: 2035
I would like to add a view to my app that shows the list of days, with the user being able to select 1 or more days (for calendar-like repetition behavior).
The concept looks like this:
Sun | Mon | Tue | Wed | Thu | Fri | Sat
I first thought about using a ListView
but there are 2 problems I can think of with that approach:
ListView
only shows items vertically and not horizontally (by default).ListView
is better than just doing it manually (LinearLayout
with 7 buttons; 1 for each day).So my question is; what is the best way to achieve it?
*I know there is already a library for an horizontal ListView
, but it's not maintained anymore, and problems are not being solved, so it's not an option.
Upvotes: 0
Views: 711
Reputation: 9375
Again, take a look at this "phone schedule" android tutorial project.
Then you can customize those checkboxes the way you exactly want them.
Unfortunately, I couldn't find an exact duplicate of the UI you had in mind already created in Android. The closest I found is the new repeat dialog bundled in the May 2013 Google Calendar update below.
Upvotes: 2
Reputation: 9434
A set of seven CheckBoxes, Switches, or ToggleButtons would work. Which one you use depends on the visual effect you are trying to achieve.
Because you are not scrolling the list or changing the underlying data (*) the list view adds no real value and considerable complexity to your code
(*) unless you have found a way to add an extra day to the week in which case I'd really like to hear about it! I need it.
Upvotes: 3