你如何使布局几款Android的屏幕尺寸? [英] How do you make layouts for several Android screen sizes?

查看:94
本文介绍了你如何使布局几款Android的屏幕尺寸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做的,对于多屏幕尺寸合作建设布局一些研究,我在找一些澄清。

I've done some research on building layouts that work for multiple screen sizes and I'm looking for some clarification.

它是常见的做法,只是做一个单独的布局文件为三个屏幕尺寸(小,中,大),或者你可以做到这一点有一个更简单的方法是什么?

Is it common practice to just make a separate layout file for each of the three screen sizes (small, medium, large) or can you accomplish this with an easier method?

我一直在测试的大屏幕设备上我的项目,即使我用的DIP(密度无关的像素)进行填充,利润等,但它仍然scrunches的东西,当我看到它在小屏幕上。我应该设计我的项目为中型屏幕,然后只允许Android的适当规模呢?

I've been testing my projects on a large screen device, and even though I use DIPs (density independent pixels) for padding, margins, etc, it still scrunches stuff up when I view it on smaller screens. Should I be designing my projects for medium-sized screens and then just allow Android to scale it appropriately?

我不知道这是一个很好的问题或没有,但我期待的普遍做法是设计为多个屏幕大小。你会怎么做?

I'm not sure if this is a good question or not, but I am looking for what the common practice is for designing for multiple screen sizes. What do you do?

编辑:除了这一点,例如,假设我有一个按钮,是40dip屏幕的底部之上,我应该从字面上写40dip,或者我应该使用某种像素的数学像40 *屏幕宽度/ blahblah或东西,使其秤取决于屏幕尺寸的用户?我已经用有限的用户界面......

In addition to this, for example, let's say I have a button that is 40dip above the bottom of the screen, should I literally write 40dip, or should I be using some sort of pixel math like 40 * screenWidth / blahblah or something so that it scales depending on the screen size the user has? I have limited experience with UIs...

推荐答案

有两个轴,当谈到屏幕大小来考虑:物理尺寸和密度。密度是通过提供骤降测量和比例适当的资源来处理。但密度并不总是意味着尺寸,反之亦然。请参阅<一href="http://developer.android.com/guide/practices/screens_support.html">http://developer.android.com/guide/practices/screens_support.html关于力学的一些进一步的信息。

There are two axes to consider when it comes to screen size: physical size and density. Density is handled by providing measurements in dips and scaled resources as appropriate. But density does not always imply size or vice versa. See http://developer.android.com/guide/practices/screens_support.html for some further info on the mechanics.

这是不常见或推荐具有基于每个屏幕上不同的布局解决方法的你的支持,但它是完全合理的设计不同的布局不同大小班(小,中,大)。不同的屏幕尺寸可能会受益于添加,删除或重新定位取决于应用程序的某些导航元素。

It is not common or recommended to have different layouts based on each screen resolution you support, but it is entirely reasonable to design different layouts for different size classes (small, medium, large). Different sized screens might benefit from adding, removing, or repositioning certain navigation elements depending on the app.

在具有一定规模的类,你应该确保你的布局容忍确切的屏幕分辨率的差异。作为Falmarri建议,使用相对布局,权重和其他可用的工具,让您的布局舒展优雅。

Within a certain size class you should make sure that your layouts tolerate variances in exact screen resolution. As Falmarri suggested, use relative layouts, weights, and the other tools available to let your layout stretch gracefully.

这篇关于你如何使布局几款Android的屏幕尺寸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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