Erik
Erik

Reputation: 5119

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 ?

What are the benefits/drawbacks?

Upvotes: 4

Views: 2356

Answers (1)

Nathan Fig
Nathan Fig

Reputation: 15119

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.

Upvotes: 6

Related Questions