ab11
ab11

Reputation: 20100

Android: how to use the 9patch creator?

I am trying to create a stretchable scroll handle for my app.

The first image is the scrollhandle.9.png that I include in my app's resources.

The second image shows what this 9patch image looks like when used in my app.

Any advice on how to accomplish a stretchable scroll handle?

enter image description here

enter image description here

Edit: With help from posters, I was able to get an image that works. I added it below to help those who may find this in the future.

enter image description here

Upvotes: 1

Views: 466

Answers (2)

manjusg
manjusg

Reputation: 2263

The area covered by the top and the left black line(dots) will be used while scaling your image. This area will be highlighted to you when you click the "show patch" option. You can see how the image scales by using the "Patch scale" option given in the draw9patch tool.

The area covered by the right and bottom lines(dots) will hold the content for the background. Eg: You can define boundaries for the text inside 9 patch image for editor background. For your case you don't need right and bottom lines.

So for your case place two dots at the top corner and two dots at the left corner. Make sure patches doesn't fall in the arrow image of the scroll(if they do fall your arrow image will also get stretched) . Try putting the dots only in the left and top lines till you get the desired preview with "Patch scale" option.

Upvotes: 2

cornbread ninja
cornbread ninja

Reputation: 427

If you use only one dot (instead of four) at the top and bottom left, and one at image top center, it should stretch the way you want it to.

Upvotes: 0

Related Questions