Amanni
Amanni

Reputation: 1934

creating a 9path image

I tried to create a 9 path drawable for a chat bubble

enter image description here

I want the image to extend vertically and have the little arrow unchanged.

I followed a few tutorials and added patches to the image then saved it as bubble.9.png but it doesn't work properly in my app. here is a screen shot

enter image description here

What am I doing wrong?

Upvotes: 0

Views: 400

Answers (1)

n3o59hf
n3o59hf

Reputation: 479

9-patch drawable needs both horizontal and vertical patches. Your bubble is missing markers on top and bottom lines of image.

Here is quick sample of working 9-patch: Sample of how it should like

More info can be found in official documentation http://developer.android.com/reference/android/graphics/NinePatch.html

You may also try to use official tool for editing 9-patches http://developer.android.com/guide/developing/tools/draw9patch.html . It has live preview and it can automatically convert normal image to 9-patch by adding border pixels. You will only need to mark necessary content and stretch areas.

Upvotes: 1

Related Questions