Several useful Calendar control implementations in Android development

Source: Internet
Author: User

As we all know, the Calendar view control has been added to Android Platform 3.0 to display the grid-like calendar content, so for the version below 3.0 to use the Calendar control only with third parties, the most currently used is CalendarView.

Let's start with a brief introduction to the use of the CalendarView Calendar control.

Android.widget.CalendarView is inherited from the android.widget.FrameLayout.

The CalendarView class provides a basic method for calendar setup:

Long GetDate () gets the number of milliseconds since 1970, January 1, 0 points 0 minutes and 0 seconds to now, since the return is a long type and ends only until 2038

int Getfirstdayofweek ()//Gets the day of the week, the Android123 hint returns the definition in the Java.util.Calendar class, such as Calendar.monday for Monday, which defines a value of 2.

Long getmaxdate ()//Get CalendarView support the maximum number of days from 1970 to that day

Long getmindate ()//Get CalendarView support the minimum number of days from 1970 to that day

Boolean getshowweeknumber ()//Gets whether the week number is displayed

Boolean isenabled ()//Whether the Calendar view is displayed

public void SetDate (long date, Boolean animate, Boolean Center)//Set the description of the selection date to 1970

void SetDate (long date)//Set selected date description to 1970

void SetEnabled (Boolean enabled)//Set whether the view is enabled

void Setfirstdayofweek (int firstdayofweek)//Set the number of days to start this week

void Setmaxdate (Long maxdate)

void Setmindate (Long mindate)

void Setondatechangelistener (Calendarview.ondatechangelistener listener)//Calendar view modified interface, see below for this introduction.

void Setshowweeknumber (Boolean showweeknumber)//Set whether the week number is displayed

The Setup interface for the Calendar control CalendarView Android.widget.CalendarView.OnDateChangeListener only implements a callback method void Onselecteddaychange ( CalendarView view, int year, int month, int dayofmonth).

These four parameters are described in detail as

View the view associated with this listener.

The year of the year is set.

Month the month that is set [0-11].

DayOfMonth the day of the month is set.

Here are some useful calendar controls to show you:

This is CalendarView. Can achieve the last month and next month page, set events and so on.

This calendar control is also powerful, but looks less friendly.

This is our own implementation of the Calendar control. You can query related data by selecting a date.

This is the calendar control that comes with the Android3.0 and above versions.

The above on the Android platform several useful calendar control, about source code Bainiu.ltd is finishing, I will be released in the following time, please look forward to ...

Several useful Calendar control implementations in Android development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.