更改日历日期android的颜色

问题描述 投票:0回答:1

嗨,我正在尝试为我的日历视图中选择的日期着色。我今天尝试过StringDate =(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
1个回答
0
投票
setTextColor(Color.GREEN);

这就是我用来改变颜色的东西。使用按钮,希望它也适合你。

© www.soinside.com 2019 - 2024. All rights reserved.