2016-05-18 82 views
2

私のアプリにはCalendarViewがあります。しかし、私はCalendarViewの背景と黒のテキストをCalendarViewの白にしたいと思っています。しかしxmlではCalendarViewにはTextColor=がありません。どうすればCalendarViewのテキストを変更できますか?Androidカレンダーの表示テキストの色の変更

私はこれまでStackOverflowとインターネット上のあらゆるソリューションを試してきました。私はCalendarViewで日の色を変更することができましたが、月と年は変更しませんでした。

は、私がこの記事では両方の方法を試してみた:Set the text color of calendar view month name

そして、私はこの方法を試してみた: Change CalendarView style

そして、いくつかの他には、私はインターネット上で見つかりましたが、何もsuccesfullのでした。

+2

この前のを見てください[questioin。](http://stackoverflow.com/questions/9412402/change-calendarview-style) –

答えて

-1
android:theme="@style/testTheme" 

このテーマまたはこのテーマとして親を持つカスタムテーマを使用してください。色は、次の

android:textColorPrimary="@color/yourColor" 

またはその他のテキストの色、あなたの次の

android:weekDayTextAppearance="@style/weekDayTextAppearance" 
    android:dateTextAppearance="@style/appTextAppearance" 
    android:unfocusedMonthDateColor="@color/colorLoginBtn" 
    android:selectedWeekBackgroundColor="@color/colorLoginBtn" 
    android:weekSeparatorLineColor="@color/colorLoginBtn" 
    android:focusedMonthDateColor="@color/colorLoginBtn" 
    android:weekNumberColor="@color/colorLoginBtn" 
1

セットスタイルを使用を使用し、白の変化以外を選択するには、それ白

ようにするに

CalendarView

<CalendarView 
    android:id="@+id/calendarView" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="center" 
    android:theme="@style/CalenderViewCustom" 
    android:dateTextAppearance="@style/CalenderViewDateCustomText" 
    android:weekDayTextAppearance="@style/CalenderViewWeekCustomText" /> 

インサイドStyle.xml

<style name="CalenderViewCustom" parent="Theme.AppCompat"> 
     <item name="colorAccent">@color/red</item> 
     <item name="colorPrimary">@color/white</item> 
    </style> 

    <style name="CalenderViewDateCustomText" parent="android:TextAppearance.DeviceDefault.Small"> 
     <item name="android:textColor">@color/white</item> 
     <item name="android:weekNumberColor">@color/red</item> 
    </style> 

    <style name="CalenderViewWeekCustomText" parent="android:TextAppearance.DeviceDefault.Small"> 
     <item name="android:textColor">@color/white</item> 
    </style> 
関連する問題