How to get the correct layout resources in Android development (LAYOUT-SW480DP Layout-sw600dp-land Layout-sw720dp-port)

Source: Internet
Author: User

Android application, we must suffer from a variety of LAYOUT-SW480DP Layout-sw600dp-land layout-sw720dp-port, often do not know their own tablet loading is which layout and have to try, Online a lot of inexplicable tutorials. I have consulted a lot of information to share with you a calculation method to determine which DP resources are loaded on your tablet. In fact, SW is not software, meaning, I guess is shortest width, the shortest breadth. the SW-XXXX-DP formula is SW *160/dpisuch as 1280*800, SW is the 480*800, SW is 480
The following example, I believe that can better understand the calculation method, where DPI is actually set in Android/device/softwinner/astar-common/astar-y3.mk, no Android source code can be through the ADB shell Getprop Ro.sf.lcd_density obtained.
Model   Resolution Sw Dpi= ro.sf.lcd_density SW *160/DPI = DP
H7 (Android5.1) 1280*720 720 213 720*160/213=540.84 = SW340DP
H7 (Android4.4) 1280*720 720 160 720*160/160=720= SW720DP
A33 Astar-y2 1024x768 768 160 768*160/160 =768 = SW720DP
Brand                800*480 480 120 480*160/120 =640= SW600DP
Brand               800*480 480 160 480*160/160 =480= SW480DP
After calculating the result by Formula SW*160/DPI, select a DP that is smaller than the result and closest to the value. For example, the example of H7 (Android 5.1) is calculated to be 540.84, if you have a sw480dp under the layout, then here DP is definitely SW480DP, if there is no SW480DP, can only find Sw340dp.land is horizontal screen, port is vertical screen.

How to get the correct layout resources in Android development (LAYOUT-SW480DP Layout-sw600dp-land Layout-sw720dp-port)

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.