Android Adaptation (screen fit, international fit)

Source: Internet
Author: User
Tags new set

first of all, the Android screen fits:

  Some basic conceptual knowledge about the Android screen, self-charging. Only use in the actual development process is described here

1, when it comes to Android screen adaptation, the first is the picture of the adaptation

Picture adaptation follows two principles: ① try to use the 9.path diagram to automatically adapt to the screen ② try to use the least amount of picture resources

About the 1th use 9.path pictures: such as topbar, bottom navigation, slide-off menu and so on various buttons background processing as far as possible to use 9.path pictures, a set of graphs

About the 2nd use of the least picture resources: many people like to cut several sets of maps to fit the screen, one takes up memory space, and the art will be not bird ...

First case: The Welcome page, the guide page and so on the picture needs to fill the entire screen, we need to do at least two sets of graphs to meet the screen adaptation (480*800, 720*1280) placed in the corresponding folder

Second case: Direct transduction (480*800) placed in the corresponding folder, let it automatically adapt to

Many people will question whether the picture will be pulled up, whether the image will be blurred and so on, after my personal test with several on-line project feedback, the above method can satisfy the majority of mobile phones.

  2. Layout adaptation

In the SRC directory to build a different resolution of the layout directory layout-1280x720 layout-800x480 in different layouts directory to create a new set of files, the size of the inside of the death is not related ... 3, Dimens adaptationIn the SRC directory to build a different resolution of the values directory values-1280x720 values-800x480 in different values directory under the new Dimens.xml file in this Dimens file can be defined for different resolutions of its size 4, the right to use the re-fitUse weight to assign screen usage (weights to fit) 5. Java Code AdaptationDynamically get the width and height of the screen and then dynamically set the size of the layout Let's take another look at the international adaptation of Android:    1. String internationalization:Just create a new values folder in the corresponding language under the Res folder, and then under the corresponding values folder, you can strings.xml the Chinese environment: VALUES-ZH English Environment: values-en US English environment: Values-en-rus Continental Area Chinese Environment: VALUES-ZH-CN 2, image internationalization:Create a new drawable folder for the corresponding language under RES English environment: drawable-en-ldpi drawable-en-hdpi drawable-en-mdpi Chinese environment: DRAWABLE-ZH-HDPI Dr AWABLE-ZH-LDPI drawable-zh-mdpi If there is not the right place to welcome Daniel to shoot bricks, if you have any good fit method, welcome message exchange

Other great article articles

 Android Learning Note (38) using ProgressDialog to create a skin feed dialog box
Large Web site architecture design-SOLR
Android Learning Note (39) Message tip Use TOAST to hint information lightly
Android Learning Note (32) grid view (GridView) and graphics switcher (Imageswi ...
Android Learning Note (31) Expandable List Component (Expandablelistview)
more about Android development articles

Android Adaptation (screen fit, international fit)

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.