Change color of calendar dates android

别来无恙 提交于 2019-12-08 10:37:56

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!