Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove paddings in a 9-patch background for textview

I have a textview which has to use a 9-patch drawable as the background. But the 9-patch drawable has left and right paddings which make the background image not stretch properly to cover the whole text. I tried resetting the paddings for the textview itself but it doesn't fix the problem.

Would anyone have any idea how to make it work?

Thanks.

like image 213
Green Ho Avatar asked Nov 19 '13 19:11

Green Ho


1 Answers

The black lines on the left and top defines the stretchable are, and those on the right and bottom marks the "content" area in a 9-patch image.

So, if you don't want padding means you want a full-length content area. You should mark full-width content area by drawing a full-length line at the bottom and right of the 9patch image.

enter image description here

In this image, the black lines on the right and bottom represent the content area. You can see the preview on the right side, and notice the content area in light blue color. You can fill the content area by extending the bottom and right lines.

like image 103
Vishnu Haridas Avatar answered Oct 21 '22 02:10

Vishnu Haridas