简体   繁体   English

Android多屏支持

[英]Android multi Screen Support

I know that for supporting different screen size we use layout,layout-large,layout-xlarge folder , but i have confusion regarding drawable folder,by default they are , 我知道,为了支持不同的屏幕尺寸,我们使用layout,layout-large,layout-xlarge文件夹,但是我对可绘制文件夹感到困惑,默认情况下它们是

1. drawable-ldpi For low density screens
2. drawable-mdpi For medium density screens
3. drawable-hdpi For high resolution screens
4. drawable-xhdpi For extra high resolution screens

   But A simple approch is 


   1.Drawable
   2.Drawable-large 
   3.Drawable-xlarge 

is it ok to go with this approch? 可以采用这种方式吗?

Google在API 13(Android 3)之后更改了布局系统,因此两者都可以使用,但是建议使用与屏幕密度有关的dpi系统,但是旧系统已被调整为屏幕尺寸,这可能会导致低dpi屏幕密度的大型屏幕设备出现问题

It is better to use screen density folders because ( quoting the Android doc ) 最好使用屏幕密度文件夹,因为( 引用Android文档

Maintaining density independence is important because, without it, a UI element (such as a button) appears physically larger on a low density screen and smaller on a high density screen. 保持密度独立性很重要,因为没有它,UI元素(例如按钮)在低密度屏幕上的物理外观会变大而在高密度屏幕上的物理外观会变小。 Such density-related size changes can cause problems in your application layout and usability. 这种与密度相关的大小更改可能会导致应用程序布局和可用性出现问题。

So using density-pixels Android scales your widgets (Buttons, ImageViews, etc) by itself relating your Activity and the Drawables you need to the appropiate res folder. 因此,Android使用密度像素自行缩放您的小部件(按钮,ImageViews等),将您的ActivityDrawables关联到适当的res文件夹。 In fact, you should be using this density system in your Layouts too (layout-mdpi, layout-hdpi, etc). 实际上,您也应该在布局中使用此密度系统(layout-mdpi,layout-hdpi等)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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