在android CalendarView中自定义工作日字符串格式

时间:2016-04-25 20:15:46

标签: android calendarview

如何在android CalendarView中更改默认日标题格式(例如从[M T W T F S S修改为[MON TUE WED THU FRI SAT SUN])?还有如何改变周六和周日的日期颜色?

1 个答案:

答案 0 :(得分:0)

您可以看到此示例https://github.com/npanigrahy/Custom-Calendar-View和用法http://javatechig.com/android/custom-calendar-view-library-in-android

在布局中添加此示例

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