【发布时间】:2021-09-09 18:07:10
【问题描述】:
我正在尝试为我的日历视图中选择的日期着色。 我试过了
String todayDate = (mDay + "/" + mMonth + "/" + mYear);
Toast.makeText(this, "TODAYS DATE" + todayDate, LENGTH_SHORT).show();
Cursor cursor = myDatabase.rawQuery("select * from " + Calms.DATABASE_FLARE_TABLE, null);
//calendarView.setDateTextAppearance(Integer.parseInt("@+color/orange"));
for(int count=1; count<=cursor.getCount(); count++)
{
cursor.moveToNext();
String savedDate = cursor.getString(2);
//calendarView.setDateTextAppearance(getResources().getColor(R.color.orange));
//calendarView.setDateTextAppearance(R.color.color);
Toast.makeText(this, "DATE IN DB: "+ savedDate, LENGTH_SHORT).show();
Toast.makeText(this, "next", LENGTH_SHORT).show();
if (savedDate.equals(todayDate))
{
Toast.makeText(this, "IN IF!!", LENGTH_SHORT).show();
//calendarView.setDateTextAppearance(Integer.parseInt("@color/orange"));
calendarView.setDateTextAppearance(getResources().getColor(R.color.orange));
}
我也尝试过 context.getRes.....
似乎没有任何效果。日期的颜色永远不会改变。
有人可以帮忙吗? 谢谢
【问题讨论】:
标签: android calendar calendarview