I am using for the first time (newbie) the above but have to formating issues. The numeric days are displayed to the right of where they should be. I did fiddle with the following code which partially worked but need a proper solution. I believe this code in the class draws the days, and please find attached as screen shot. I tried on the emulator and my acual
samsung s4, but need a fix of course for all devices
B4X:
Private Sub DrawDays
cvsBackground.DrawColor(Colors.Transparent)
cvs.DrawColor(Colors.Transparent)
Dim firstDay As Long = DateUtils.SetDate(year, month, 1) - 1
dayOfWeekOffset = DateTime.GetDayOfWeek(firstDay) Mod 7
daysInMonth = DateUtils.NumberOfDaysInMonth(month, year)
If year = selectedYear AND month = selectedMonth Then
'draw the selected box
DrawBox(cvs, selectedColor, (selectedDay - 1 + dayOfWeekOffset) Mod 7, _
(selectedDay - 1 + dayOfWeekOffset) / 7)
End If
For day = 1 To daysInMonth
Dim row As Int = (day - 1 + dayOfWeekOffset) / 7
cvs.DrawText(day, (((dayOfWeekOffset + day - 1) Mod 7) + 0.5) * boxW, _
(row + 0.5)* boxH + vCorrection, Typeface.DEFAULT_BOLD, Label1.TextSize, Colors.Black, "CENTER")
Next
' Dim firstWeek, lastWeek As Int
' firstWeek = DateTime.GetDayOfYear(DateUtils.SetDate(year, month, 1)) / 7 + 1
' lastWeek = DateTime.GetDayOfYear(DateUtils.SetDate(year, month, daysInMonth)) / 7 + 1
' For week = firstWeek To lastWeek
' Log(week)
' Next
DaysPanel.Invalidate
End Sub