0

I'd like to ask about one of the hardest thing for me (as a programmer) in android. As I make software mostly without designer (to be honest - totally without a designer) I can't figure out the following:

When I draw a png I use px (not dp) as image width.

I drew a button image with the following sizes: hdpi: 318x45 mdpi: 212x30 (6 to 4 ratio) and I would like my button be 80% width of Galaxy s2 which is

Screen Size in Pixels: 480 Pixel x 800 Pixel Screen Size in dp: 352dp x 587dp

But also I would like to have the same width (80%) for hdpi 10' tablet. Is it possible or I'm missing something?

And is it possible to make 80% but not more than XXX pixel width?

4

2 回答 2

0

您只需要为不同的屏幕尺寸和密度提供不同尺寸的图像。当您考虑它时,您只需要担心几种不同的格式。然后,您将为每种格式创建一个“80%”大小的图像,将它们放在单独的可绘制文件夹中,并相应地使用它们。

关于支持多种屏幕尺寸和提供替代资源android 文档实际上非常全面地介绍了如何做到这一点。

否则我很抱歉你没有设计师。我的提示 - 如果你有这样的方式,你可以在 Adob​​e Illustrator 中制作你的图标,这样你就可以轻松地将它们缩放到你需要的任何大小。作为矢量图像,它们不会丢失质量,因此您可以随意更改大小。准备好后,只需在大小断点处为网络和设备导出,就可以了。

于 2013-06-05T18:31:14.157 回答
0

您必须使用该android:layout_weight属性。

此处类似问题中概述的详细信息

于 2013-06-05T18:32:38.887 回答