I am trying to create a calendar in android which will display the number of appointments scheduled for a musician in a day. Each cell of the calendar is going to look like;
- If there is any appintment then a guitar at the center of the cell (day of calendar).
- Current day (Ex:”01″ will be displayed for Jan1st) at the upper-right corner.
- A number at the lower-left corner to display the number of appointments for that day.
I am a new user and hence cannot post an image until I earn some reputation at stackoverflow.
For now I am using an android.widget.Button to create each cell(day) of the calendar, but this limits me from setting all 3 items (guitar icon, day, number of appts) inside the day cell. For now, I am using a image (white background with a guitar icon) as button background to get the guitar at center, then I use the button.setText to set the day number at the upper right corner, but not sure abt how to get the 3rd item (number of appts in the lower left corner) inside the day cell.
Can you guys please advise me on the best way of achieving this? Do I need to use something other than Button?
A Button is little more than a slightly different TextView, and hence I don’t see any straightforward way to set two pieces of text with different alignments to the Button, without creating your custom view to accomplish this. In a way you’re trying to set two TextViews as the content of a single TextView – that’s not possibile with the current implementation.
Personally, I’d consider implementing a GridView to represent your calendar (days). A GridView allows you to completely customize the cell content and the layout you’re trying to accomplish can easily be realised by means of two separate TextViews – one aligned at the bottom left, the other at the right top – and a background image for the cell.
Have a look at the Hello GridView tutorial for some more implementation-specific details.