How Android apps adapt to different resolutions of your phone

Source: Internet
Author: User

Mainly divided into three blocks consider  1) interface configuration   Create a mobile interface file   Example: Create a layout-800x480  in res           with different resolutions layout-480x320  and create the interface file under their respective resolution folder  2) picture configuration   Different resolution, interface aspect ratio inconsistent, need different specifications of the picture   in drawable-hdpi, DRAWABLE-LDPI,DRAWABLE-MDPI images in different resolutions   note: In order to reduce the overall application installation package size, choose the highest resolution adaptation, special interface Image Special processing  3) dynamic implementation of the interface, style settings   Different resolutions, the font size of the interface, fonts, etc. need different styles, and need to be dynamically generated in the case, you need to save the configuration information of different resolutions to the application.   Example: Create values-480x320 values-800x400  value-1280x720  in res and create Dimens.xml <dimen in the created folder Name= "Text_size" >30px</dimen>  direct call R.dimen.text_size int Sizeoftext = (int) in the program This.getresources (). Getdimension (r.dimen.text_size);   Note: The actual application found that the font size adaptation, such as only the following screen fonts   values-480x320 values-800x480  value-1280x720  The maximum font adaptation (value-1280x720)   Summary is automatically found when a phone screen resolution of 854x480 is present: If the font 800x480 above is not fitted, the phone automatically fits to the maximum resolution .  reference: http://www.cnblogs.com/leizhenzi/archive/2011/08/03/2126305.htmlhttp:/ /407827531.iteye.com/blog/973688
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.