Reputation: 39538
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:
and the tool seems to work fine:
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?
EDIT:
My picture is named *.9.png
Upvotes: 4
Views: 5507
Reputation: 3169
Check if you have at least one black pixel on all four sides of your images.
Upvotes: 3
Reputation: 2571
The black lines have to be totally black(RGB:#000000) and the transparent zone around black lines totally transparent.
Upvotes: 11
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