正如您所发现的,TextView是私有的,似乎没有任何访问它的方法。
尽管我不推荐这样做,但是您可以使用以下
java.lang.reflect程序包来完成此操作:
try { CalendarView cv = (CalendarView) this.findViewById(R.id.calendarView1); Class<?> cvClass = cv.getClass(); Field field = cvClass.getDeclaredField("mMonthName"); field.setAccessible(true); try { TextView tv = (TextView) field.get(cv); tv.setTextColor(Color.RED); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } catch (NoSuchFieldException e) { e.printStackTrace(); }


