Question

OK, I've read a lot of tutorials and even downloaded some examples, but for the love of Stackoverflow, I can't get my image to stretch like I want it to and I'm hoping that someone can help me out here.

I create an image that is to be the background of a button object in Android. Here is the image:

enter image description here

Now, I'd like for it to stretch to the desire size of the button, whether the button is 50x50dp or 200x100dp. One thing I don't want is the border to stretch as it will look distorted, so I want to specify not to include the border, but stretch everything else to the desired size of the button.

Can someone please show me where the black lines need to go in order to achieve my goal? Do I have to change my original image in order to achieve my goal?

Thank you in advanced. David

Was it helpful?

Solution

It's very simple using this tool Android Asset Studio: Simple 9-Path Generator. Although no matter how you do it you will have stretching and distortion due to the textured (non-patterned) background. I would stay away from that style both personally and for usability.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top