Android fit Screen

Source: Internet
Author: User

Summary of their own screen experience, there must be a lot of shortcomings, which is related to the ability, only hope that their continuous improvement, continuous improvement, if there is a warm-hearted "senior" guidance, greatly appreciated!

Android5.0 has come out, said that this version of the Android screen to do a lot of work, but for my chronic children, I am still patient to wait and see, 5.0 has been a lot of resolution, just started to do Android when the head is big, but slowly or accumulated a number of appropriate screen experience, in this summary A moment.


I. Use of resource identifiers


1. Resolution (density) identification applies with


Android resolution has four categories, later will not be more, I do not know, but the words to reach a certain threshold for the eyes of the future can not distinguish it, after all, in the mobile phone so small screen, and then meticulous is not worth it

Low resolution: LHDP (120DP)

Normal resolution: MDP (160DP)

High resolution: HDP (240DP)

Ultra High resolution: XHDP (320DP)

Super high resolution: XXHDP (480DP) This is the super resolution after API Lev 16


The difference in resolution mainly affects the display of Android mobile phone, if some color or vector background is not affected, such as directly with color or the definition of XML type drawable to do the background of the view, some of the techniques combined with layout will not be affected by the resolution. Take the time to summarize, say, with the above resource identifier for the image to provide a variety of dimensions, as follows:

After you connect a resource identifier with a dash to res/drawable, for example:

res/drawable-lhdp/: 75% of normal picture size

res/drawable-hdp/: 100% of normal picture size

res/drawable-hhdp/: 150% of normal picture size

res/drawable-xhdp/: 200% of normal picture size

res/drawable-xhdp/: 300% of normal picture size

Just like the application's startup picture, you should also set multiple resolution types, 36*36 (pixels), 48*48 (pixels), 72*72 (pixels), 96*96 (pixels), 144*144 (pixels), respectively, in the corresponding project file directory can be implemented at different resolutions, Displays the corresponding picture.


2. Size Resource identification applies with


SMALL:426*320 (DP)

NORMAL:470*320 (DP)

large:640*480 (DP)

XLARGE:960*720 (DP)

Have XXLarge:?


3. Platform Identifier Qualification


V4

V9

V11

V14

...


4. Screen identifier limit


Land


5. Precise Qualification


W<N>DP: Precision-qualified width resolution

H<N>DP: precise height-limiting resolution

SW<N>DP: Indicates that the layout file underneath this layout folder is loaded only if the minimum bandwidth for the short edge of the device is N. Your device is 800x480 resolution, then this APK installed on your device will load the layout file inside the LAYOUT-SW480DP.


The above identifier is usually used in the Res file directory of Drawable,layout and values, for example: layout-550dp-large;drawable-large-mdpi;values-1134*720 (large number in the previous decimal after)

and add in Androidmanifest.xml.

<supports-screens
Android:anydensity= "true"
Android:largescreens= "true"
Android:normalscreens= "true"
Android:smallscreens= "true"
Android:xlargescreens= "true"/>


In addition to the above resource identifier qualification, if you want more precise settings, you can use the dimen under Values , for the requirements are not very strict, can be combined with relativeyout,linearlayout, there are easy to ignore the framelayout, set the view of the width of the high (android:layout_width= "" Android: Layout_height= ""), use match or wrap, and then set layout_margin= "" or padding= "" to control the distance.



second, Android-supported units


1. Units


PX: pixels

In: Inch

MM: MM

PT: lb (1/72) inches

DP: PX-independent pixels

Dip: Is DP

SP: Scale-independent pixels, similar to DP, can be scaled based on preference for user font size



2. Unit Conversions

Under standard resolution (160DP):


1DP = 1dip = 1px

1pt = 160/72SP

1pt = 1/72 inch






Android fit Screen

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.