Android: change year directly in Material-calendarview

I am using https://github.com/prolificinteractive/material-calendarview

Now he changes the month by pressing the right or left arrow

How can I change the year directly, and not change the month. Is this possible by default for Android by default. Below is my code for prolificinteractive - calendar

public class ActivityCalendar extends AppCompatActivity implements OnDateSelectedListener, OnMonthChangedListener { private static final DateFormat FORMATTER = SimpleDateFormat.getDateInstance(); private MaterialCalendarView widget; private String zodiacSign = ""; private HashMap<String,Integer> hashMapMonth = new HashMap<>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_calendar); widget = (MaterialCalendarView)findViewById(R.id.calendarView); widget.setOnDateChangedListener(this); widget.setOnMonthChangedListener(this); } @Override public void onDateSelected(@NonNull MaterialCalendarView widget, @Nullable CalendarDay date, boolean selected) { String strDate = getSelectedDatesString(); Intent returnIntent = new Intent(); returnIntent.putExtra(TagClass.BIRTH_DATE, strDate); setResult(Activity.RESULT_OK, returnIntent); finish(); } @Override public void onMonthChanged(MaterialCalendarView widget, CalendarDay date) { //noinspection ConstantConditions } private String getSelectedDatesString() { CalendarDay date = widget.getSelectedDate(); if (date == null) { return "No Selection"; } return FORMATTER.format(date.getDate()); } } 

layout.xml

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".ActivityCalendar"> <com.prolificinteractive.materialcalendarview.MaterialCalendarView android:id="@+id/calendarView" android:layout_width="match_parent" android:layout_height="wrap_content" /> </LinearLayout> 
+6
source share
1 answer

It does not seem possible with this library, as it is now.

To do this, you will need to download sources from github and add it to your project as a library module.

Then I expect that changes will be needed, at least in these components:

I also got the impression that making these changes would also lead to a mayor refactor in the library.

+2
source

All Articles