Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 353
Waza_Be Avatar asked Dec 01 '22 05:12

Waza_Be


2 Answers

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

like image 142
VinceFR Avatar answered Dec 05 '22 02:12

VinceFR


The extention of your 9-patch image should end with .9.png or it will be taken as a normal image

like image 36
K_Anas Avatar answered Dec 05 '22 00:12

K_Anas