简体   繁体   English

支持多种屏幕尺寸?

[英]Supporting multiple screen sizes?

I'm developing an android app and I was testing it in a note II device. 我正在开发一个android应用程序,并且正在note II设备中对其进行测试。 The problem is that now, when I deploy it to small devices(3,7''), the layouts don't look the way they suppose to. 现在的问题是,当我将其部署到小型设备(3,7'')上时,布局看起来并不像他们想象的那样。 So I've done some reading and find out that I can split the layouts in order to have different files depending on the screen size/density. 因此,我已经进行了一些阅读,发现我可以拆分布局,以便根据屏幕尺寸/密度使用不同的文件。 My question is how should I divide the folders? 我的问题是我应该如何划分文件夹? Layout-low, layout, layout-medium or use de layout-sw600p notation? 低布局,低布局,中等布局还是使用de layout-sw600p表示法? The other thing is when I look to other apps on github they don't seem to care about this and they look fine on all devices. 另一件事是,当我在github上查看其他应用程序时,他们似乎对此并不关心,并且在所有设备上看起来都不错。 Can someone give me a explanation on this? 有人可以给我一个解释吗? My api lvl is 16 and above. 我的api等级是16以上。

One handy way to make apps look great on different size devices is to use fragments. 使应用在不同大小的设备上看起来很棒的一种便捷方法是使用片段。 Have a look at this document : http://developer.android.com/guide/components/fragments.html#Design 看看这个文档: http : //developer.android.com/guide/components/fragments.html#Design

In this case you can use the DisplayMetrics class in order to get the device's size. 在这种情况下,您可以使用DisplayMetrics类来获取设备的大小。 And you can say for example that devices that are small will use a fragment and bigger ones will use another fragment. 例如,您可以说较小的设备将使用一个片段,较大的设备将使用另一个片段。 If you want to make this separation by the device's screen size(inches) you can see the accepted answer on this question: How to get screen size of device? 如果要按设备的屏幕尺寸(英寸)进行分隔,则可以看到以下问题的可接受答案: 如何获取设备的屏幕尺寸?

Also the guide mentioned by Antonio MG on his answer is very useful. Antonio MG在回答中提到的指南也非常有用。

All we can tell you is already said here: 我们所能告诉您的已经在这里说了:

Supporting Multiple Screens 支持多屏

Just go trough these guide and all your answers will be there. 只需仔细阅读这些指南,您的所有答案就会在那里。

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

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