Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display Monday as first day CalendarView

With:

Calendar cal = Calendar.getInstance();
cal.setFirstDayOfWeek(Calendar.MONDAY);

you just set Monday's integer value to 0, but I want to have Monday displayed as first day (at the left end, and Sunday at the right)

like image 690
Werdli Avatar asked Mar 05 '13 08:03

Werdli


People also ask

How do you make a calendar start on a Monday?

Change Calendar to start from Monday on AndroidOpen Google Calendar. Tap on the hamburger menu (3-vertical lines in the top left corner) and open Settings from the bottom. Open General. Tap Start of the week and select Monday.

Does Monday have a calendar?

monday.com's Calendar View allows you to see all of your project's tasks and activities by date. It's a great way to visualize your project in its entirety, and to see when tasks are due.


1 Answers

Use xml parameter android:firstDayOfWeek with value from Calendar. 2 - is Monday.

    <CalendarView
    android:id="@+id/calendarView1"
    android:firstDayOfWeek="2"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="157dp" />

Or you can specify it from code

    CalendarView calendarView = findViewById(R.id.calendarView1);
    calendarView.setFirstDayOfWeek(Calendar.MONDAY);
like image 73
andrew Avatar answered Nov 07 '22 18:11

andrew