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) {
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>
source share