Search code examples
androidimageviewnine-patchstretch

Why are the 9 patch not working at all in my app?


I am currently trying to use 9 patch pictures in my app.

The image is quite clear and work pretty well in the graphic tool provided with SDK:

Picture is like this:

enter image description here

and the tool seems to work fine:

enter image description here

Unfortunately, with such a simple layout, the rendering is bad on a device and the 9 patch does not work at all:

<TextView
    android:id="@+id/platenumber"
    android:background="@drawable/plate_fr"
    android:layout_width="320dip"
    android:layout_height="wrap_content" />

Any idea on what I am doing wrong?

enter image description here

EDIT:

My picture is named *.9.png

enter image description here


Solution

  • The black lines have to be totally black(RGB:#000000) and the transparent zone around black lines totally transparent.