开发者

android Can nine-patch images be used instead of the hdpi,mdpi,ldpi

what about nine-patch images.

Can they be used instead of the ?

  • /res/drawable-hdpi/icon.png ….. 72×72

  • /res/drawable-mdpi/icon.png …. 48×48

  • /res/drawable-ldpi/icon.png 开发者_运维问答…… 36×36

What are the benefits/drawbacks?


Technically you don't ever have to provide an image for all three resolutions- if one is missing, the system will replace it with one of the others. Though it's usually better to have all three for maintaining appearance across all screen densities.

9-patch can be used instead, but should be only under specific circumstances. If you have an image for a button that expands but preserves the corners, keep in mind these corners are going to look much smaller on a high resolution screen if you don't provide an hdpi version. But the size of the image itself will still expand according to the specified stretch areas.

So in a nutshell: 9-patch does allow an image to expand as needed independent of resolution, but the non-stretchable parts of the image will not be magically converted to higher/lower resolutions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜