Android Configuration description (not completed)

Source: Internet
Author: User

Blog is very empty, want to quickly fill an article, choose this topic to see the next Chinese network is not very common, but because I do not understand all the configuration, need to verify the idea, writing is also very slow, first sent an unfinished occupy seat.

The so-called Config refers to the configuration information represented by the Configuration.java class, where it is located ($ANDROID _root)/frameworks/base/core/java/android/content /res/configuration.java

This article is divided into three parts:

First, explain the member variables, understand the function and the meaning of each value represented;

Two. To search for the initialization and use of the configuration process;

Three. Summarize how these values are configured as an Android platform maintainer.

I. Member variables

public int densitydpi //the target screens density being rendered to corresponding to density resource qualifier.

The current is generally a 3-digit 10 binary number, respectively, corresponding to:

    • 120 –> ldpi: Low-Density screens.
    • 160 –> mdpi: Medium-density (on traditional HVGA) screens.
    • 240 –> hdpi: High-density screens.
    • 320 –> xhdpi: Extra high-density screens.

Then there are larger xxhdpi (480) and XXXHDPI (640), the larger the densitydpi, the higher the screen resolution (Dpi,dot per inch) of the current device, the densitydpi of a device is determined at the factory based on the device screen dpi. Suppose I now have a mx3,1800x1080 resolution,5.1 inches, then its dpi is the diagonal pixel number divided by 5.1 equals 411.6, and I configured densitydpi to be the closest xxhdpi to 411.6. Its purpose is to allow the app to fit these devices without knowing the screen size and resolution of each Android device by densitydpi dynamically deciding what resources to load.

For example, in the UI when the general use of DP to do the unit, the system will help to zoom, in different resolutions of the device visually will have the same size, and the pixel do only fixed pixel size, the same pixel size of the view in the high-resolution device visually relatively small. Here is the conversion of pixel and DP:

Dp= px*160/densitydpi;

In addition, there will be some drawable-mdpi/drawable-hdpi/drawable-xhdpi in the Res directory of the app, which is also determined by densitydpi, of course, the sub-methods of these directories are more complicated, and there is not much to say here.

Public float Fontscale //current user preference for the scaling factor in fonts, relative to the base density s Caling.

public int Hardkeyboardhidden

A flag indicating whether the hard keyboard have been hidden.

public int keyboard

The kind of keyboard attached to the device.

public int Keyboardhidden

A flag indicating whether any keyboard is available.

Public locale Locale

Current user preference-the locale, corresponding to locale resource qualifier.

public int MCC

IMSI MCC (Mobile country Code), corresponding to MCC resource qualifier.

public int MNC

IMSI MNC (Mobile Network Code), corresponding to MNC resource qualifier.

public int Navigation

The kind of navigation method available on the device.

public int Navigationhidden

A flag indicating whether any 5-way or DPAD navigation available.

public int Orientation

Overall orientation of the screen.

public int SCREENHEIGHTDP

The current height of the available-screen space, in DP units, corresponding-to-screen height resource qualifier.

public int Screenlayout

Bit Mask of overall layout of the screen.

public int SCREENWIDTHDP

The current width of the available-screen space, in DP units, corresponding-to-screen width resource qualifier.

public int SMALLESTSCREENWIDTHDP

The smallest screen size an application would see in normal operation, corresponding to smallest screen width resource qual Ifier.

public int Touchscreen

The kind of touch screen attached to the device.

public int Uimode

Bit Mask of the UI mode.

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.