Arnab Chaudhuri
Arnab Chaudhuri

Reputation: 41

Customize week day string format in android CalendarView

How to change the default day header format(e.g. modify from [M T W T F S S] to [MON TUE WED THU FRI SAT SUN]) in android CalendarView? also how to change the date color of Sat and Sunday?

Upvotes: 1

Views: 1862

Answers (1)

Gorio
Gorio

Reputation: 1646

You could see this example https://github.com/npanigrahy/Custom-Calendar-View and usage http://javatechig.com/android/custom-calendar-view-library-in-android

Add this sample in your layout

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical">

    <com.imanoweb.calendarview.CustomCalendarView
        android:id="@+id/calendar_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/white"
        app:selectedDayTextColor="@color/accent_500"
        app:calendarBackgroundColor="@color/white"
        app:calendarTitleTextColor="@color/black"
        app:currentDayOfMonthColor="@color/blue"
        app:dayOfMonthTextColor="@color/black"
        app:dayOfWeekTextColor="@color/black"
        app:disabledDayBackgroundColor="@color/blue_grey"
        app:disabledDayTextColor="@color/white"
        app:selectedDayBackgroundColor="@color/blue"
        app:titleLayoutBackgroundColor="@color/white"
        app:weekLayoutBackgroundColor="@color/white">
    </com.imanoweb.calendarview.CustomCalendarView>
</LinearLayout>

Upvotes: 0

Related Questions