ixx
ixx

Reputation: 32269

nine patch image doesn't work

I did a 9 patch image with android tool draw9patch.bat. Draw a black line only on the right side, where I want it to stretch. Saved as .9.png and set it to background of TextView:

android:background="@drawable/myninepatch"

It doesn't work, I get the image with the black line in the app and it doesn't stretch. What am I doing wrong?

I have seen at some places besides of the lines for the stretchable area there's also a very small marked area in the opposite side, but I don't know what is it for and I'm not using it.

Upvotes: 2

Views: 4165

Answers (2)

Adam Monos
Adam Monos

Reputation: 4307

In 9 patch images the right and bottom side lines indicate the padding, eg. the size which below the image won't shrink. The segment indicated by the top and left side line will stretch and shrink according to the desired size.

Upvotes: 2

Chirag
Chirag

Reputation: 56935

Check this guideline . Here you can find simple UI Guideline for nine patch images .

Upvotes: 6

Related Questions