Android development self-study note (Android Studio) & mdash; 4. Simple Introduction to interface programming and View components, androidstudio

Source: Internet
Author: User

Android development self-study note (Android Studio)-4. Simple Introduction to interface programming and View components, androidstudio
I. Introduction

The most important part of Android Application Development is interface development. No matter how good your program contains, if there is no good user interaction interface, in the end, it will only be abandoned by users. The Android SDK provides a large number of UI components with rich functions. Developers only need to drag and drop to complete simple applications. These are just the display of the interface. To achieve excellent user interaction, of course, the event response mechanism is also the focus.

The vast majority of Android sdk ui components are in androd. widgets and their sub-packages, android. view and its sub-packages, all the UI components in the Android Application inherit the View class. The View class also has an important subclass: ViewGroup. The following describes these two classes.

Ii. View

What is a View? Maybe everyone has their own different understandings. In the official Android documentation, this class indicates the basic building module of the user interface. A View occupies a rectangular area on the screen and is responsible for interface rendering and event processing. View is a base class used to build user interface components (buttons, Textfields, and so on. In fact, to put it bluntly, the View is a blank rectangle area, similar to the panel in winform and the JPanel in swing development. We can define our own controls in this blank rectangle area.

For the View class, it is the base class of all UI components, so it is the property that can be used by all components, so it is recommended to take a closer look at the View class attributes in the API.

3. ViewGroup

ViewGroup is a subclass of View, so it can also be used as a View. It can be used as a container to put other components. Because ViewGroup is an abstract class, it is usually used as a subclass of ViewGroup, for example, layout-class UI components in the UI component are inherited from ViewGroup.

Iv. Context

In practice, no matter which UI component is created, a Context parameter is required. What is Context? Context is required to attach resources, start a new Activity, obtain system services, obtain the path of internal files (folders), and create a View. The attention of Context is visible. Context literally refers to the Context, or a scenario, that is, a process in which the user and the operating system operate, such as making a call. The scenario includes the interface corresponding to the telephone program and the data hidden behind it; from the Android system perspective, Context is a scenario that represents a process of interaction with the operating system. From the perspective of the program, Context is an abstract class, and Activity, Service, and Application are all implementations of this class. Therefore, Activity and Service can be directly used as Context.

V. Conclusion & Notice

From the last chapter to this chapter, it has been a long time. Recently, the company's management has changed and the staff flow is very large. So I am very busy as a small person... The progress is a little behind, but I don't want to let go of the technology, so I just want to take some time to continue reading books and reading blogs. The latest versions of Android Studio have been updated to 1.5.X, and I have also updated to 1.4.1 on the machine. Therefore, the title of the article will no longer contain version information, as long as the version is 1.3.x and later, it should be supported, if you have any questions, you can communicate with each other.

 

Well, let's talk about something to learn. I think the arrangement of the crazy handout book is very reasonable for the study of UI components, and I also agree very much. So I learned it based on this idea, the subsequent sections of the UI component will follow this idea. Because there are many UI components, if we do not straighten out their relationships, we can learn them in isolation and forcibly remember them. It is estimated that it will be very difficult to learn them, so next we will follow their internal associations, it is divided into several groups for learning:

Group 1: Layout Components

LinearLayout, TableLayout, FrameLayout, RelativeLayout, GridLayout, and AbsoluteLayout)

Group 2: TextView and its subclass

TextView, EditView, Button, RadioButton, CheckBox...

Group 3: ImageView and its subclass

ImageView...

Group 4: AdapterView and its subclass

ListView... Adapter interface...

Group 5: ProgressBar and its subclass

ProgressBar, SeekBar, RatingBar...

Group 6: ViewAnimator and its subclass

ViewSwitcher, ImageSwitcher, TextSwitcher...

Group 2: miscellaneous components

Toast, calendar view, time (date) selector, value selector, search box...

Group 8th: Dialog Box

Date (time) Selection dialog box, progress dialog box...

9th group: menu 10th group: ActionBar

 

These contents are tentative and may be adjusted based on the actual learning content.

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.