Change CalendarView style
In my project I defined the attribute "android:calendarViewStyle" in my theme.
<style name="Theme.Custom" parent="@android:Theme">
<item name="android:calendarViewStyle">@style/Widget.CalendarView.Custom</item>
</style>
<style name="Widget.CalendarView.Custom" parent="android:Widget.CalendarView">
<item name="android:focusedMonthDateColor">@color/cs_textcolor</item>
<item name="android:weekNumberColor">@color/red</item>
<item name="android:weekDayTextAppearance">@style/TextAppearance.Medium</item>
<item name="android:dateTextAppearance">@style/TextAppearance.Medium</item>
</style>
All styles possibilities are:
- @attr ref android.R.styleable#CalendarView_showWeekNumber
- @attr ref android.R.styleable#CalendarView_firstDayOfWeek
- @attr ref android.R.styleable#CalendarView_minDate
- @attr ref android.R.styleable#CalendarView_maxDate
- @attr ref android.R.styleable#CalendarView_shownWeekCount
- @attr ref android.R.styleable#CalendarView_selectedWeekBackgroundColor
- @attr ref android.R.styleable#CalendarView_focusedMonthDateColor
- @attr ref android.R.styleable#CalendarView_unfocusedMonthDateColor
- @attr ref android.R.styleable#CalendarView_weekNumberColor
- @attr ref android.R.styleable#CalendarView_weekSeparatorLineColor
- @attr ref android.R.styleable#CalendarView_selectedDateVerticalBar
- @attr ref android.R.styleable#CalendarView_weekDayTextAppearance
- @attr ref android.R.styleable#CalendarView_dateTextAppearance
note: if showWeekNumber not work as xml style, you can set in the code with setShowWeekNumber(true).
Change the style of Android Calendar View
I don't know How to create Custom Calendar but you might check this GitHub library.You may succeed in creating the one, you are asking for with just little customization
https://github.com/prolificinteractive/material-calendarview
And also Refer to this Useful Stackoverflow post from which you will definitely be able to implement a CalenderView as you wanted.
Custom Android calendarView
Change CalendarView style
In my project I defined the attribute "android:calendarViewStyle" in my theme.
<style name="Theme.Custom" parent="@android:Theme">
<item name="android:calendarViewStyle">@style/Widget.CalendarView.Custom</item>
</style>
<style name="Widget.CalendarView.Custom" parent="android:Widget.CalendarView">
<item name="android:focusedMonthDateColor">@color/cs_textcolor</item>
<item name="android:weekNumberColor">@color/red</item>
<item name="android:weekDayTextAppearance">@style/TextAppearance.Medium</item>
<item name="android:dateTextAppearance">@style/TextAppearance.Medium</item>
</style>
All styles possibilities are:
- @attr ref android.R.styleable#CalendarView_showWeekNumber
- @attr ref android.R.styleable#CalendarView_firstDayOfWeek
- @attr ref android.R.styleable#CalendarView_minDate
- @attr ref android.R.styleable#CalendarView_maxDate
- @attr ref android.R.styleable#CalendarView_shownWeekCount
- @attr ref android.R.styleable#CalendarView_selectedWeekBackgroundColor
- @attr ref android.R.styleable#CalendarView_focusedMonthDateColor
- @attr ref android.R.styleable#CalendarView_unfocusedMonthDateColor
- @attr ref android.R.styleable#CalendarView_weekNumberColor
- @attr ref android.R.styleable#CalendarView_weekSeparatorLineColor
- @attr ref android.R.styleable#CalendarView_selectedDateVerticalBar
- @attr ref android.R.styleable#CalendarView_weekDayTextAppearance
- @attr ref android.R.styleable#CalendarView_dateTextAppearance
note: if showWeekNumber not work as xml style, you can set in the code with setShowWeekNumber(true).
Change Month text color in CalendarView
Having defined following in styles.xml
:
<style name="CustomCalendarMonth" parent="AppTheme">
<item name="android:textColorPrimary">@color/orange</item>
</style>
<style name="CustomCalendarDay" parent="TextAppearance.MaterialComponents.Caption">
<item name="android:textColor">@color/green</item>
</style>
<style name="CustomCalendarWeek" parent="TextAppearance.MaterialComponents.Caption">
<item name="android:textColor">@color/purple</item>
</style>
Then in xml:
<CalendarView
android:theme="@style/CustomCalendarMonth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:dateTextAppearance="@style/CustomCalendarDay"
android:weekDayTextAppearance="@style/CustomCalendarWeek" />
Here will be the output:
Related Topics
Full Screen Dialogfragment in Android
Download the Android Sdk Components for Offline Install
Android Gradle Apache Httpclient Does Not Exist
Android - Setonclicklistener VS Onclicklistener VS View.Onclicklistener
How to Always Run a Service in the Background
How to Manipulate the Camera Preview
Snappy Scrolling in Recyclerview
What Is the Purpose of Android's <Merge> Tag in Xml Layouts
Progressdialog Is Deprecated.What Is the Alternate One to Use
How to Build an Android Library with Android Studio and Gradle
Toolbar and Contextual Actionbar with Appcompat-V7
Best Practice for Nested Fragments in Android 4.0, 4.1 (<4.2) Without Using the Support Library
Simulate Low Network Connectivity for Android
Launching Custom Android Application from Android Browser/Chrome
Android - Getting Audio to Play Through Earpiece