2013-02-18 238 views
0

嗨我想爲日曆視圖中選擇的日期着色。我試過 String todayDate =(mDay +「/」+ mMonth +「/」+ mYear);更改日曆日期的顏色android

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 .....

似乎沒有任何工作。日期的顏色永遠不會改變。

任何人都可以提供幫助嗎? 謝謝

+0

[Android CalendarView for Showing Events]可能的副本(http://stackoverflow.com/questions/16556254/android-calendarview-for-showing-events) – blahdiblah 2013-11-06 00:28:19

回答

0
setTextColor(Color.GREEN); 

這是,我用什麼來改變我的顏色。與按鈕一起工作,希望它也適用於您。

+0

calendarView沒有.setTextColor()方法。它確實有.setDateTextApperance(),但這不會改變顏色 – user2026576 2013-02-18 14:27:46

+0

已經在這裏看看? http://developer.android.com/reference/android/widget/CalendarView.html – Ekonion 2013-02-18 14:33:51

+0

我認爲這是你正在尋找的:http://w2davids.wordpress.com/android-simple-calendar/ – Ekonion 2013-02-18 14:46:19