Search code examples
androidandroid-layoutbackgroundpngnine-patch

Android: 9-patch png is treated like a normal png


I've made this 9-patch png and added it to the res/drawable folder:

enter image description here

It works nice in the example eclipse shows:

enter image description here

But on the emulator it looks messed up:

enter image description here

Why is this happening and how can I fix this?

EDIT: The border on which I've placed the black dots is white, not transparent. Not sure if that's got anything to do with it...


Solution

  • This probably happens because you have a small mistake with the black pixels you have set. Try to re-cut the edges of the picture and to add the black pixels all over again.

    I had this problem too once and this helped me.

    if the border is white then this is your problem it has to be pure black or nothing at all.

    UPDATE: Try this image:

    enter image description here