Android smart phone platform multi-resolution solution detailed

Abstract: In recent years, smartphones have become more and more powerful, mobile terminal applications have emerged endlessly, and the mobile Internet has changed people's lives. The Android system is an open source mobile phone operating system launched by the Open Mobile Alliance. It is precisely because of its openness that it does not use hardware-defined standards similar to Windows PhONe7. At present, there are more and more models based on the Android system, and some hardware indicators have appeared. In the chaotic situation, the most obvious problem is the screen resolution. How to make the developer's application adapt to as many resolutions as possible is exactly the problem to be described in this article. The article first introduces the system architecture of Android, then introduces the relevant terminology of resolution in the Android platform, then focuses on how to deploy resources and the principles that should be followed during the development process, and finally gives the method of testing multi-resolution compatibility.

0 Preface

In November 2007, Google released the mobile terminal operating system based on Linux 2.6 kernel-Android. Because of its open source, it was sought after by many mobile phone manufacturers and favored by application developers. In recent years, smartphones have developed rapidly, and indicators such as operating speed, storage capacity, and reliability have been significantly improved [1]. Today ’s smartphone users have greater expectations for the comfort and beauty of application software, and the application interface Friendship has become more and more important. However, due to the open source nature of Android, the screen resolution of hardware manufacturers is not uniform. According to statistics, there are more than 10 types of resolutions for Android mobile phones on the market. The wide distribution of resolutions has caused developers to encounter many resolutions in dealing with multi-resolution adaptation. problem. The article first introduces the system architecture and resource management methods of the Android platform, then introduces the methods currently used by developers when dealing with multi-resolution, and then focuses on analyzing the Android platform resource loading mechanism and gives the multi-resolution processing steps and techniques in conjunction with examples. Finally, the method of testing multi-resolution effects is introduced.

1 Introduction to the Android platform

Android is a software stack of mobile devices including operating system, middleware and key applications [2]. Android system, like other systems, uses a layered architecture. From bottom to top, it is the Linux operating system and drivers, program library and Android runtime environment, application framework layer, and application layer. The basic components of the Android application are AcTIvity, Intent, BroadcaSTReceiver, and Service. The configuration information of each component and configuration information such as rights management and version management are stored in AndroidManifest.xml.

1.1 Android application resource management

The picture loaded on the phone interface is a type of Android resource, in addition to XML resources (anim.xml layout.xml, etc.) and original data files (audio and video files, etc.) [3]. Create a new HelloAndroid Android application. The file structure generated by default includes folders such as src, gen, assets, res, and the AndroidManifest.xml configuration file. The Android source code is stored in the src folder, the res folder represents the resource files that the application needs to use, and the gen package contains the R.java file. All resource files contained in the Res folder correspond to R.java.

After the developer adds a file of the corresponding type in any subdirectory in the res / directory, ADT will automatically generate a static int type constant in the corresponding anonymous inner class in the R.java file to index the added file.

The Android system adopts this architecture to separate resource files such as views from the control code to achieve loose coupling. However, you can use the R.java file to access the corresponding resource file in the code for flexible operation.

1.2 General multi-resolution processing methods and their disadvantages

1.2.1 Image zoom

Based on the accuracy of the current screen, the platform automatically loads any unscaled images of limited size and accuracy. If the pictures do not match, the platform will load the default resources and meet the display requirements of the current interface after zooming in or out. For example, if it is currently a high-precision screen, the platform will load high-precision resources (such as bitmap resources in drawable-hdpi in HelloAndroid). If not, the platform will scale the medium-precision resources to high precision, resulting in unclear image display.

1.2.2 Automatically define pixel size and position

If the program does not support multiple precision screens, the platform will automatically define the absolute pixel position and size values, etc., so as to ensure that the elements can display the same size effect as the screen with a precision of 160. For example, to make a WVGA high-precision screen display the same size picture as a traditional HVGA screen, when the program does not support it, the system will confuse the program with a screen resolution of 320 & TImes; 480, between (10, 10) and (100, 100) After drawing the graphics in the area, the system will enlarge the graphics to the screen display area from (15, 15) to (150, 150).

1.2.3 Compatible with larger screens

When the current screen exceeds the upper limit of the screen supported by the program, define the supportsscreens element, so that when the displayed baseline is exceeded, the platform displays a black background image here. For example, on a WVGA medium-precision screen, if the program does not support such a large screen, the system will lie about a 320 & TImes; 480, and the extra display area will be filled with black.

1.2.4 Using OpenGL to dynamically draw pictures

The bottom layer of Android provides OpenGL interfaces and methods that can draw pictures dynamically, but this approach is a big challenge for developers who are not familiar with computer graphics. Generally develop games, using OpenGL.

1.2.5 Multiple apk files

Symbian and traditional J2ME use this method to provide multiple resolution versions for an application. Users can download and install corresponding executable files according to their own needs. It is a good way to develop an application for each screen separately, but currently Google Market's support for multiple resolution versions of an application is not perfect, and developers still need to use an apk file to adapt to multiple resolutions as much as possible.

Home and indoor or building air filters remove unwanted particles like dust, pollen, pet dander and mold and ensure even the most allergy prone can breathe easily year–round. However, choosing the right filter for your home can be a rather involved process. To help, here are the most common indoor air filters and what each of them provides. The filters are the simplest basic component for air filtration solution through your heating and cooling system ,It is important that you constantly monitor the buildup of debris on these filters as well because it can easily be recycled into the air supply. It is easy change and maintain.

Indoor Air Purification Filter & Air purifier filter

AC Filter,Air Conditioner Filter,AC Furnace Filter,Home AC Filter

Donguan Bronco Filter Co., Ltd , https://www.broncofilter-cn.com

Posted on