Search code examples
androidandroid-listviewnine-patch

Android Content Area changes (nine-patch background image)


I have a listview that I customized, I add a background image with nine patch with the setBackground method, but the problem is that the content area is not respected I have text that exceeds whereas when I set the property manually the list appears well

what to do to fix this problem?

enter image description here

enter image description here


Solution

  • That's not even a valid 9-patch. You should connect the dots on the bottom and right borders (to define your content area), and your 9-patch should be much much smaller than that. All but one pixel of the white space from left to right is redundant and can be removed. Really, this would be better done with a rotated TextView placed in a layout of some sort (Linear, Relative, etc.)