Andrei Stalbe
Andrei Stalbe

Reputation: 1531

Android 9 patch drawables

A simple little question: does 9 patch drawables have to be created in 4 different sizes for different screen resolutions and placed inside the [drawables] - ldpi | mdpi | hdpi | xhdpi or just one image and to be placed inside the drawables folder? What's the best pracatice?

Upvotes: 1

Views: 344

Answers (2)

Basically NO, But if your image contains complex shapes which cant be maintained by 9patch itself then your have to create separate images.

Upvotes: 1

Matt Gibson
Matt Gibson

Reputation: 38238

You don't have to create it in multiple sizes, but it may look better if you do, depending on the image and how you're using it.

The gain 9-patching gets you is mostly in the "stretching" of certain (probably-uniform) areas. The non-stretched areas will still benefit from multiple resolution versions just as they would if they weren't in a 9-patch, e.g. if you only have a low-res 9-patch the "detail" areas of it may look unpleasantly scaled on a high resolution screen.

Upvotes: 3

Related Questions