Android uses GridView to implement calendar function example (detailed code)

Android uses GridView to implement calendar function. There are a lot of codes. Send a picture first:

If you're too lazy to look down, you can download the source code directly. Recently, someone has been asking for it. Because it's too long, you're too lazy to find out and sort it out. Today, you see someone asking for it. You just have nothing to sort it out

Download the source code....

Layout file:

Item:

Adapter:

Calculation class

Festival and lunar calendar calculation

Explanation of 0x04bd8,0x04ae0,0x0a570 in calendar implementation code:

The correct explanation is:

Binary form

xxxx xxxx xxxx xxxx xxxx 20-17 16-12 12-9 8-5 4-1

1-4: indicates whether there is a leap year in the current year. If yes, it is the month of leap month. If not, it is 0.

5-16: indicates whether the normal month except leap month is a big month or a small month. 1 is 30 days and 0 is 29 days.

Note: from January to December, it corresponds to the 16th to the 5th.

17-20: indicates whether the leap month is a big month or a small month. It is meaningful only when there is a leap month.

for instance:

The data for 1980 is 0x095b0

Binary: 0000 1001 0101 1011 0000

Indicates that there was no leap month in 1980. The number of days from January to December is 30, 29, 29, 30, 29, 30, 29, 30, 30, 29, 30 and 30.

The data for 1982 is 0x0a974

0000 1010 0 1001 0111 0100

It means that April in 1982 is a leap month, that is, there is the Second April, and it is a leap month.

The number of days from January to march is 30, 29, 30, 29, 29 (leap month), 30, 29, 29, 30, 29, 30, 30, 30, 30 and 30.

Activity

Download the source code....

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>