问题
Hi I am trying to color the date selected in my calendarview. I have tried 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));
}
I have also tried context.getRes.....
Nothing seems to work. The colour of the date never changes.
Would anyone be able to help? Thanks
回答1:
setTextColor(Color.GREEN);
this is, what i am using to change my colors. Works with buttons, hope it works for you, too.
来源:https://stackoverflow.com/questions/14937783/change-color-of-calendar-dates-android