1
I’m working with calendars on Android. The goal is to show the calendar by weeks and for months. But the calendar I’m using only allows me to view by month.
Xml code
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.prolificinteractive.materialcalendarview.MaterialCalendarView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/calendarView"
android:layout_centerInParent = "true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:mcv_showOtherDates="all"
app:mcv_selectionColor="#00F"
/>
</android.support.constraint.ConstraintLayout>
Activity where this is invoked
MaterialCalendarView materialCalendarView = (MaterialCalendarView) findViewById(R.id.calendarView);
materialCalendarView.state().edit()
.setFirstDayOfWeek(Calendar.MONDAY)
.setFirstDayOfWeek(Calendar.DAY_OF_WEEK)
.setMinimumDate(CalendarDay.from(1900, 1, 1))
.setMaximumDate(CalendarDay.from(2100, 12, 31))
.setCalendarDisplayMode(CalendarMode.MONTHS)
.commit();
//quando um dos dias é selecionado
materialCalendarView.setOnDateChangedListener(new OnDateSelectedListener() {
@Override
public void onDateSelected(@NonNull MaterialCalendarView widget, @NonNull CalendarDay date, boolean selected) {
Intent intent = new Intent(getBaseContext(), ActivitySelecionado.class);
enviarDados(intent, date);
startActivity(intent);
}
});
From what I have here it is possible to configure the calendar to have the view by weeks?