安卓:支持多屏幕 [英] Android: support multiple screens

查看:163
本文介绍了安卓:支持多屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Android的一个应用程序。我想,它应该是能够在不同的屏幕尺寸的多种手机上运行,​​所以我研究href="http://developer.android.com/guide/practices/screens_support.html">支持多屏开发商,并根据,我要创建3种不同的XML文件支持三种不同的屏幕尺寸,并有3种图像的每个类型的XML文件中。但是,在博客上,我得到使用当前的屏幕大小的方法这样做的想法。所以我很困惑,我应该做的。装置,它被优化和性能提高的方式。哪一个会更完美支持所有类型的屏幕(除了超大屏幕)

I am trying to make a application in Android. I want that it should be able to run on multiple phones of different screen sizes, so i studied support multiple screen on developers and according to that i have to create 3 different xml files for supporting three different screen sizes and also 3 different types of images for each type of xml file. But on a blog i get the idea of doing this by using current screen size method. So i am confused what i should do. means which is optimized and performance increasing way. And which one will be more perfect for supporting all types of screen(except extra large screens)

推荐答案

定义高度,宽度等参数在XML文件中是更好的选择,而不是在运行时间。 因为XML文件可以作为元数据(数据载体),以活性和避免了很多混乱时的onCreate mothode中调用。 此外,创建图像质量(华电国际,xhdpi,国防专利机构,LDPI)

Defining height, width and other parameters in the XML file is the better option rather than on run time. Because XML files works as metadata (data carrier) to the activity and avoids alot of confusion when onCreate mothode in called. Plus, create different folders for image quality (hdpi,xhdpi,ndpi,ldpi)

7英寸设备的使用mhpi 10英寸的设备使用华电国际和xhdpi 虽然NEXUS卡使用它们的大小华电国际和xhdpi无关。 手机使用LDPI和国防专利机构。

7 inch device use mhpi 10 inch devices use hdpi and xhdpi While NEXUS tabs use hdpi and xhdpi irrespective of their size. Mobiles use ldpi and ndpi.

美就出在这里的是,Android设备的时候发现,即布局和图像自动拾取-P合适的内容。 如果没有找到它首先会搜索其他版式文件夹,如布局不是X-LARGE文件夹中找到那么它将在很大程度上搜索,然后中型,小型,哪一个适合最好的,(如果不是找到一个布局其相应的文件夹)。

Beauty lies here is that android device automatically pick-p the suitable content when found, i.e layout and image. If not found it would first search other Layout folders,e.g a layout not found in x-large folder then it will search in large,then medium, small, which one of them suits the best ,(if a layout is not found in its respective folder).

的Nexus将创建为你带来麻烦很多。 要检查你的布局将如何看待不同的设备,请尝试使用的选项,它会告诉你它是如何看该设备上的那些高度宽度,present布局的图形(的观点)。

Nexus will create alot of trouble for you. To check how your layout would look on different devices, try using the options, which tells you how it would look on that device with those height width, present in the Graphical (view of a ) layout.

这篇关于安卓:支持多屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆