简体   繁体   English

如何制作不同屏幕尺寸的图像?

[英]How to make images for different screen sizes?

Getting my head around Android, I've sort of trouble understanding support for multiple devices. 围绕Android,我在理解对多种设备的支持时遇到了一些麻烦。 I've gone through the dev-docu, now for the clear-up: 我已经通过了dev-docu,现在进行清理:

The idea behind using dp is, that eg a button has the same 'real-world'-size, independent of the actual screen-size, right? 使用dp的想法是,例如,一个按钮具有相同的“真实世界”大小,与实际屏幕大小无关,对吗? If so, that means, I provide the images in ldpi, hdpi and so on. 如果是这样,则表示我以ldpi,hdpi等格式提供图像。 That results in a button, that has always the same size. 这将产生一个始终具有相同大小的按钮。 If still correct, I understand that now, that my buttons always has the same size, I should provide different layouts, because on a small device, there might only be space for two next to one another, where on a larger device there's room for three. 如果仍然正确,我现在知道我的按钮始终具有相同的大小,我应该提供不同的布局,因为在小型设备上,可能只有两个相邻的空间,而在较大的设备上则有空间三。

If all of the above is correct, my question would be, how I deal graphics-tool-wise with it. 如果以上所有方法都是正确的,我的问题将是如何处理图形工具。 Say I have a button 100px x 100px at 300dpi, what sizes and dpi's would that be for the new documents in eg Gimp for the different screensizes? 假设我在300dpi处有一个100px x 100px的按钮,那么对于不同屏幕尺寸的Gimp中的新文档来说,它们的尺寸和dpi是什么?

Thanx in advance for any smoke-lifting! 提前感谢任何烟熏! Marcus 马库斯

What it means when you can use your custom assets for different screen densities is that when you put those respective assets, they will not scale again and use them as they are. 当您可以将自定义资产用于不同的屏幕密度时,这意味着当您放置这些资产时,它们将不会再次缩放并按原样使用它们。 Now it is true that the size of the screen also varies. 现在,屏幕的大小确实也有所变化。 That is when you can consider tweaking your layout. 那是您可以考虑调整布局的时候。

For example in a large screen you may be able to fit two components beside each other and use a linear layout with horizontal alignment. 例如,在大屏幕中,您可能能够使两个组件彼此并排放置,并使用水平对齐的线性布局。 But when it comes to a small screen, that might not be possible and one option is to define a new layout for small screens and say pt those two components in a vertical layout. 但是当涉及到小屏幕时,这可能是不可能的,一个选择是为小屏幕定义新的布局,然后说这两个组件为垂直布局。

For more information regarding how to implement this and best practices, check these Android Docs 有关如何实施此方法和最佳做法的更多信息,请查看以下Android文档

After some more study, it seems that the graphocs-tools DPI are actually the one referred to in eg the baseline. 经过更多研究后,似乎graphocs-tools DPI实际上是基线中所指的一种。 So to create a baseline-doc, you indeed create a document 470 x 320 pixel in size and a resolution of 160 dpi. 因此,要创建基线文档,您实际上确实创建了一个470 x 320像素的文档,分辨率为160 dpi。 The rest goes from there. 其余的从那里去。

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

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