Android Development Tutorial Calendar Project Practice (i) _android

Source: Internet
Author: User
Tags class definition

Foreword: decided to begin to study the software development under the Android platform, take the calendar as the practice project, after a week, basically completes. In order to summarize and note, and for the need of friends for reference, began to organize this tutorial.

before you start :

Before you write a program, you need to design the project, because it is a practice project, primarily to determine the software UI interface, which is a completed screenshot:



For this picture, further decomposition:


The total is decomposed into three View files :

1:activity_main.xml

As the main screen for startup, when you create a new project, you build it first.

2:view_calendar_table.xml

Defines a monthly calendar view with the head fixed and other rows added dynamically by code.

3:view_calendar_day_cell.xml

Defines a view of each day, consisting mainly of three elements: Gregorian date, lunar calendar information, or whether it is today's tagged Image.


the corresponding code class definition :


Because to implement the left and right slider, the scenario here is to use Viewpager. Calendarpageradapter for Viewpager to provide multiple frame management, we designed the goal is to display the Gregorian calendar 1901-2,100 interval, the corresponding frame screen has (2100-1900) * 12 frames screen, if more to create, will occupy very large memory resources Source. will be managed by Viewpager, which determines when a frame is created and when it is destroyed to conserve memory resources. For more information please refer to: http://developer.android.com/reference/android/support/v4/view/ViewPager.html

Related Article

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.