I'd like to print out a calendar for my activity, is there any good open source?

Asked 2 years ago, Updated 2 years ago, 116 views

If you put up a calendar for the activity, press 10 days, and press 20 days, I'd like to specify a range from the 10th to the 20th so that I can click on it, is there an open source that supports such a function?

calendar java

2022-09-22 22:09

1 Answers

https://github.com/square/android-times-square If you look at it, you will get a calendar view that provides the function you want. To briefly explain how to use it

build.gradle to dependency compile 'com.squareup:android-times-square:1.6.5@aar' Please add

Go to layout xml

<com.squareup.timessquare.CalendarPickerView
    android:id="@+id/calendar_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    />

Insert the code above

And go to the code of the activity you want to print out

Calendar nextYear = Calendar.getInstance();
nextYear.add(Calendar.YEAR, 1);

CalendarPickerView calendar = (CalendarPickerView) findViewById(R.id.calendar_view);
Date today = new Date();
calendar.init(today, nextYear.getTime())
    .inMode(RANGE);

You can do it like this.


2022-09-22 22:09

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.