我修改了gridview日历的this sample code。我想只显示一行(即一周),所以我添加了行if (list.size() != 7)
,它给了我当前周(七天)。
现在我想在下周7天用户点击按钮时显示。我怎么能这样做?
以下是显示当前周的代码:
int t;
btnnextweek.setOnClickListener(new OnClickListener()
{
public void onClick(View arg0) {
// TODO Auto-generated method stub
t=7;
adapter = new GridCellAdapter(getApplicationContext(), R.id.calendar_day_gridcell, month, year);
adapter.notifyDataSetChanged();
calendarView.setAdapter(adapter);
}
});
// Current Month Days
for (int i = 1; i <= daysInMonth; i++)
{
Log.d(currentMonthName, String.valueOf(i) + " " + getMonthAsString(currentMonth) + " " + yy);
if (list.size()!=7)
{
if (i == getCurrentDayOfMonth())
{
list.add(String.valueOf(i) + "-BLUE" + "-" + getMonthAsString(currentMonth) + "-" + yy);
}
else
{
list.add(String.valueOf(i) + "-WHITE" + "-" + getMonthAsString(currentMonth) + "-" + yy);
}
}
}