Android view framework and android View

Source: Internet
Author: User
Tags vector font

Android view framework and android View
Android view framework

The Android UI system is the core and basic content of the android Application System Framework!

1. AndroidView System and hierarchical relationship

The Android Application Design is similar to the Web application design, and is also divided into front-end and back-end design. The core elements and four components of Android are the backend design, while the uidesign is the front-end design. The front-end design determines the quality of user experience, and the backend design determines the completeness of functions and the security and stability of applications.

For Android UI design, two most important classes are used: View and ViewGroup. They determine the shape of the display interface. The following describes the hierarchy of the Android view system:

                  Figure 1. UI)

    

The View class is the base class of all View controls (including ViewGroup. Various UI controls inherit the View class and implement specific functions through different interfaces. For more information about the inheritance relationship, see:
                  Figure 2. Control inheritance

        

                  Figure 3. Common UI controls
      

2. Android view framework MVC model

The Android UI framework is also organized using MVC. It provides a controller to process user input, perform corresponding operations on the model, and feedback the results to the view, re-build the view, and render it to the screen.

Figure 4. MVC model of Android UI

       

 

 

3. Android view Execution Process Analysis

In Android development, view layout is written in an XML file. By adding corresponding controls to the XML file, you can set its attributes to achieve layout. A simple layout file is as follows:

  Demo. xml file content

<? Xml version = "1.0" encoding = "UTF-8"?> // Declare the encoding and version of the xml file <LinearLayout // use a linear layout that acts internally on the internal control, 17th linear arrangement // The referenced namespace xmlns: android = "http://schemas.android.com/apk/res/android" android: layout_width = "fill_parent" android: layout_height = "fill_parent" android: padding = "5dp" android: orientation = "vertical"> // internal control arrangement direction: vertically arrange <EditText // Add a text input box control android: id = "@ + id/show" // set the Control ID // various attribute settings for the control from the beginning to the end to display the specific style android on the interface: layout_width = "match_parent" android: layout_height = "wrap_content" android: layout_marginTop = "10dp" android: layout_weight = "2" android: lines = "3" android: editable = "false" android: gravity = "top | right" android: cursorVisible = "true" android: text = "" android: textSize = "24sp"/> // end the Control </LinearLayout> // layout end flag

After a layout file (demo. xml) is created, a new Test. java file is created to use the layout file, as shown below:
Test. java File Content

Package com. acerWang. test; import android. app. activity; import android. OS. bundle; import android. view. view; // the newly created Test must inherit the Activity to create the Activity public class Test extends Activity {// reload the onCreate method to generate a new Activity. The View is displayed in the Activity, for the role of an ActivityPrevious Article. @ Overrideprotected void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); // output the previously written layout file to the screen setContentView (R. layout. demo );}}

 

4. Summary
The above is a brief introduction to the structure, principle and execution process of the Android view framework. I hope it will be helpful to new users. The introduction has many principles and is boring, but it is very important. I hope I can stick to it and see more, which will be good for future development. Of course, there are still a lot of in-depth content not involved. I will share it with you in the future. Please also point out that you are learning from each other and making progress together!


Android framework parameters -- Annotation

<Dimen name = "thumbnail_height"> 12020.dip </dimen>
Scaling chart height
<Dimen name = "thumbnail_width"> 12020.dip </dimen>
Scaling chart width
<Item type = "dimen" name = "dialog_min_width_major"> 65.0% </item>
Minimum dialog box width Main Parameter

<Item type = "dimen" name = "dialog_min_width_minor"> 94.99999% </item>
Minimum dialog box width parameters
<Dimen name = "config_prefDialogWidth"> 3201_dip </dimen>
Configuration _ option dialog box width
<Dimen name = "config_viewConfigurationTouchSlop"> 8.0dip </dimen>
Configuration _ view configuration touch threshold
<Dimen name = "toast_y_offset"> 64.0dip </dimen>
Y coordinate offset of the prompt box
<Dimen name = "fastscroll_overlay_size"> 104.0dip </dimen>
Quick tumble overlap size
<Dimen name = "fastscroll_thumb_width"> 64.0dip </dimen>
Quickly tumble and scale down the Image Width
<Dimen name = "fastscroll_thumb_height"> 52.0dip </dimen>
Quickly tumble and scale down the Image Height
<Dimen name = "min_xlarge_screen_width"> 8001_dip </dimen>
<Dimen name = "preference_fragment_padding_bottom"> 0.0dip </dimen>
<Dimen name = "preference_fragment_padding_side"> 16.0dip </dimen>
<Dimen name = "preference_breadcrumb_paddingLeft"> 0.0dip </dimen>
<Dimen name = "preference_breadcrumb_paddingRight"> 0.0dip </dimen>
<Dimen name = "preference_icon_minWidth"> 0.0dip </dimen>
<D ...... remaining full text>

What is the five application development frameworks of android?

The android Application Development Framework consists of five parts: Linux Kernel, Android Runtime, Libraries, Application Framework, and Applications. The second part will detail these five parts. The bottom-up analysis layers are as follows.

Android Architecture

1. Linux Kernel

Android provides core system services based on Linux 2.6, such as security, memory management, process management, network stack, and driver model. Linux Kernel is also an abstraction layer between hardware and software. It hides specific hardware details and provides unified services for the upper layer. If you have learned computer networks and know OSI/RM, you will know that the benefit of layering is to use the services provided by the lower layer to provide unified services for the upper layer, shielding the differences between the current layer and the following layers, when the current layer and the following layers change, the upper layer is not affected. That is to say, each layer performs its own duties, and each layer provides a fixed SAP (Service Access Point). The professional points can be said to be high cohesion and low coupling. If you are only engaged in application development, you do not need to have a deep understanding of the Linux Kernel layer.

2. Android Runtime

Android contains a collection of core libraries, providing most of the functions available in the core library of Java programming language. Every Android application is an instance in the Dalvik Virtual Machine and runs in its own process. The Dalvik virtual machine is designed to efficiently run multiple virtual machines on one device. The Dalvik Virtual Machine executable file format is. dex. dex is a compression format designed for Dalvik, suitable for systems with limited memory and processor speed. Most virtual machines, including JVM, are stack-based, while Dalvik virtual machines are register-based. The two architectures have their own advantages and disadvantages. Generally, the stack-based machine requires more commands, while the register-based machine requires more commands. Dx is a set of tools that can convert Java. class to. dex format. A dex file usually has multiple. classes. Because dex sometimes has to be optimized, it will increase the file size by 1 to 4 times and end with ODEX. The Dalvik Virtual Machine relies on the Linux kernel to provide basic functions, such as thread and underlying memory management.

3. Libraries

Android contains a collection of C/C ++ libraries for various components of the Android system. These functions are exposed to developers through the Android application framework. The following lists some core libraries: system C library-the BSD derivative of the Standard C system library (libc), adjusted to the embedded Linux device media library-The PacketVideo-based OpenCORE. These libraries support playing and recording many popular audio and video formats, as well as static image files, including MPEG4 and H. 264. Manage MP3, AAC, AMR, JPG, and PNG interfaces-manage the access display subsystem and seamlessly combine the 2D and 3D graphics layers LibWebCore of multiple applications-a new Web browser engine, driver Android browser and Embedded web View SGL-Basic 2D graphics engine 3D library-Based on OpenGL ES 1.0 APIs implementation. Libraries use hardware 3D acceleration or include highly optimized 3D software grating FreeType -- bitmap and vector font rendering SQLite -- powerful and lightweight relational database engines available for all applications

4. Application Framework

By providing an open development platform, Android enables developers to develop extremely rich and novel applications. Developers can freely take advantage of the hardware advantages of devices, access location information, run background services, Set alarms, and add notifications to the status bar. Developers can fully use the APIs framework used by core applications. Architecture of the application ...... the remaining full text>

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.