First, Introduction
Android, in order to interact with the device's screen, requires the use of two core Java classes. They are the most commonly used and most important two classes in Android development:
- View class
- ViewGroup class
View and ViewGroup are the core upper classes, which, like all Java classes, derive from the Java object class. View objects can be created using the view class, which can also be used to create many or more lower-level, or more specific, Java classes that are derived from the view class and inherit all the attributes of their superclass.
Second, view class
The entire displayed screen can consist of one or more view objects, depending on how the view class and the ViewGroup class are used to create UI artifacts for the screen of an Android application. Here's a look at what controllable properties the view class provides for Android opener:
- Boundary (size)
- The layout on the screen
- Layer Display Order
- Rolling
- Focus
- Key interaction
- Gesture interaction
The View object has the ability to receive events, that is, to receive interactive events from the application user and the View object. Therefore, the view class is a Java component that can be derived to construct more detailed and specific UI elements, such as: Buttons, checkboxes, single-line buttons, and text boxes.
Three, nested views: ViewGroup class
ViewGroup is a subclass of view derivation that is used to derive a layout container class that groups and organizes the view objects on the screen in an orderly manner.
ViewGroup is a layout container, which is typically a collection of UI elements that can be buttons, text boxes, check boxes, and so on. That is, the UI element can be of any type (including a custom new control derived from the view class).
(This image comes from an introduction to Android app development)
ViewGroup derived subclasses are: Absolutelayout, Relativelayout, Framelayout, LinearLayout, and Drawlayout. About, these types of layouts are described in detail: http://www.cnblogs.com/naray/p/5274964.html
ANDROID View Structure