不同的9补丁图像不同的密度? [英] Different 9-patch images for different densities?
问题描述
我在MDPI /华电国际/ xhdpi相同的9片图像。有没有特别的原因,为什么它不会被保存的最小尺寸是多少?可拉伸区域自动缩放当含量更高,例如一个背景为一个9补丁
I have the same 9-patch images in MDPI / HDPI / xhdpi. Is there a particular reason why it will not be saved for the smallest size? The stretchable areas scale automatically when the content is greater, for example a background as a 9-patch.
例如背景:
MDPI:
mdpi:
华电国际:
hdpi:
xhdpi:
xhdpi:
推荐答案
很多9补丁是如此之小,他们通常并不需要重新创建不同的屏幕大小。
Many nine patches are so small that they normally don't need to be recreated for different screen sizes.
在你的榜样背景的边角不进行缩放。如果你只是使用相同的弯道上的所有决议,他们将有不同的分辨率不同的尺寸。在较小的手机边角会出现较大的上大手机边角也显得更小。
In your example the corners of the background are not scaled. If you just use the same corners on all resolution they would have a different size on different resolutions. On smaller phones the corners would appear bigger on bigger phones the corners would appear smaller.
另一个例子是一条线。如果你有一条线,是具有特殊的作用,在创建它作为一个九补丁MDPI屏幕和线路是两个像素的高。只是重用此绘制无缩放xhdpi屏幕上会使得此屏幕上您的线路2个像素高。但由于屏幕有更小的像素(分辨率更高,同样的显示尺寸),该行似乎thiner。
Another example would be a line. If you have a line that is has a special effect and you create it as a nine patch for mdpi screens and the line is two pixel high. Just reusing this drawable without scaling on a xhdpi screen would make your line two pixel high on this screen. But because the screen has smaller pixels (higher resolution, same display size) the line would appear thiner.
因此你总是需要创建一个9补丁每项决议,或@Shubhayu说,只有生产出高清晰度的9补丁,并接受他们得到模糊的,如果系统规模下来的其他决议。
Therefore you always need to create a 9-Patch for every resolution, or as @Shubhayu said only produce high resolution nine patches and accept that they get blurry if the system scales them down for other resolutions.
这篇关于不同的9补丁图像不同的密度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!