Waza_Be
Waza_Be

Reputation: 39538

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

Upvotes: 4

Views: 5507

Answers (3)

gingo
gingo

Reputation: 3169

Check if you have at least one black pixel on all four sides of your images.

Upvotes: 3

VinceFR
VinceFR

Reputation: 2571

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

Upvotes: 11

K_Anas
K_Anas

Reputation: 31466

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

Upvotes: 6

Related Questions