帮帮我,我使用这个示例http://www.androidhub4you.com/2012/10/custom-calendar-in-android.html?showComment=1374298656772#c7739428050175524218 我只想打印当前的一周。我只想显示单行。我将此示例代码修改为我的代码。我用这个条件替换了示例代码: if (i == currentWeekDay)
. 但它只显示日期的第一周。今天的日期是 7 月 20 日。不显示今天的星期几。我的屏幕如下所示:
我如何只显示本周?
// Current Month Days
for (int i = 1; i <= daysInMonth; i++) {
Log.d(currentMonthName, String.valueOf(i) + " "
+ getMonthAsString(currentMonth) + " " + yy);
if (i == getCurrentDayOfMonth()) {
list.add(String.valueOf(i) + "-BLUE" + "-"
+ getMonthAsString(currentMonth) + "-" + yy);
} else {
list.add(String.valueOf(i) + "-WHITE" + "-"
+ getMonthAsString(currentMonth) + "-" + yy);
}
}
// Current Month Days
for (int i = 1; i <= daysInMonth; i++) {
Log.d(currentMonthName, String.valueOf(i) + " "
+ getMonthAsString(currentMonth) + " " +
yy);
if (i == currentWeekDay)
{
if (i == getCurrentDayOfMonth()) {
list.add(String.valueOf(i) + "-BLUE" + "-"
+ getMonthAsString(currentMonth)
+ "-" + yy);
} else {
list.add(String.valueOf(i) + "-WHITE" + "-"
+ getMonthAsString(currentMonth) +
"-" + yy);
}
}
}