简体   繁体   中英

Android app for different screen size

i'm an italian guy and i'm developing an android app for a course that i'm attending at Information and Communication Technologies university. This is my question: following android philosophy, it is right to create 12 folders for different values of hight and width (in dpi) in android?

I mean:

values-ldpi
values-mdpi
values-hdpi
values-xhdpi
values-small-ldpi
...
...
...
values-xlarge-hdpi
values-xlarge-xhdpi

I can't use "match_parent" or "wrap_content" everywhere, so for some components i have to specify the size in dpi.

这是正确的,但是您可以通过简单地巧妙地放置 XML 布局、使用 Fragments 并考虑允许使用一些相对位置描述的设计来获得完整的方法。

There is not a generic rule that can work always. In some cases you could have to use values-land , values-v14 , values-large-land-v14 , values-sw720dp ....depends on the app you want to achieve.

Don't forget values-xxhdpi

Your solution is certainly the most exhaustive and thorough. It isn't necessarily "right" as you say though.

Ideally you would be able to create values/layouts/drawables for every possible combination of screen size/density. In the real world, it is more common to focus on a particular subset.

For example, you can have a look at the most commonly used screen densities here (updated periodically).

There are particular drawbacks to being exhaustive, including large .apk sizes if you are dealing with drawables, and as such you can scale back your approach and focus elsewhere, or release multiple .apk's for your application.

There is an in-depth article on Supporting Multiple Screens on Android here which is well worth a read.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM