0

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...

4

3 に答える 3

5

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

于 2013-03-24T19:12:25.367 に答える
2

It seems you are not saved your image with .9.png

In order to make it work do like this save your image in the following format in your drawable folder

yourimage.9.png (not png format of your image)

Check this reference draw 9 patch

于 2013-03-24T19:14:35.847 に答える
2

The Android SDK contains a 9-patch editing tool (draw9patch.bat) that can help you to produce and/or validate 9-patch images. Without it, it is very easy to make a mistake in defining your border.

The one-pixel border should be transparent except for the black pixels that define the various parts of the image to be treated differently during scaling.

于 2013-03-24T20:13:55.597 に答える