Search code examples
androiddrawablenine-patch

Creating a 9 Patch with repeatining pattern


iam stuck with the creation of a nine patch for a progressbar background. It has a repeating pattern like a ruler-scala and that given me headache.

here is a image of what i want(at the bottom) and what i have (top). 9Patch Problem

can someone give me a hint how to acomplish my goal?

edit: or is it generelly possible to do this with a 9patch? my other attempt was to make a with android:tileMode="repeat" but there i get problems with the height of my image (repeating in the second line), i need something like repeat-x.

Thanks in advance

edit2: ok i managed to do my repeating 9patch by stretching the whole repeating pattern, but its not ideal :(


Solution

  • You seem to be overestimating the power of 9-patches. The most you could do is have a ruler image with expanding space between the ticks. You can't, however, make a 9-patch that automatically tiles parts of your image.

    On the other hand, if you create a BitmapDrawable programatically, you can set the tile mode separately for the X and Y axes.