Original, practical Android screen adaptation program sharing

Source: Internet
Author: User

(ashamed to say, this period of busy project, have time to ridicule life, a long time did not write technical articles)


Truly usable, and easy to use, the Android screen can be adapted to a good performance on multiple screen sizes and screen densities.

has been used in a mature Internet application, the effect is good.






Speaking of Android development, the UI interface of the multi-machine adaptation, has always been a very important issue.
Online this aspect of the article many, interview often will ask, most of the content is very similar, no outside use dp,sp do not use PX and other commonplace problems.
But it will be said that the majority of practical solutions can be implemented, few people will.

When I was interviewing, a lot of people even drawable-hdpi and drawable-mdpi inside the picture is suitable for different screen density, or screen resolution will be mistaken.
The so-called multi-model adaptation, no outside the scripted.

Some colleagues around, work for several years, or will only fit their own mobile phone, even the screen density is not known. Only know that each time will give the UI/1.5 ... Sweat.....



Here are my scenarios:


First do not need DP, distance units to define their own, this step, not necessary to change, just need to change the place you were 20dp to @dimens/dimen_20_dip.


Then, you can resolve their own units to the specific PX, without DP. This step if you write, the workload is very large, I wrote a small tool, it is possible to generate a key, just to the program generated resource files, copy to the Res folder can be used.


Finally, the Android system is looking for the Dimens.xml file in the corresponding resource directory to get the most appropriate value. This step does not require your participation.



OK, Finish.




Tool: http://download.csdn.net/detail/zmobs/8570269


Tool Source Address: http://download.csdn.net/detail/zmobs/8573051


QQ Group: 241300694 Program Life


Official website: www.dqqdo.com









Original, practical Android screen adaptation program sharing

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.