Skip to main content
Question

Autolayout with complex background

  • January 28, 2021
  • 5 replies
  • 2999 views

Konrad

Hi there! I am kind a newbie so please be gentle 🙂
I want to create an autolayout button with complex background, it is not a simple rectangle as you see below:


And i simply can’t do it with this shape, I can’t place it as a background under the label

Could you please help me?

This topic has been closed for replies.

Gleb
  • Power Member
  • January 28, 2021

You can’t do that because that shape is a simple vector object. And it will look very bad if you stretch it. I recommend creating two separate sides to create the shape and placing the rectangular auto layout in the middle. I just added an example into this file I created and you can find other useful examples there too:

Figma

Konrad
  • January 28, 2021

Thanks mate, I will play with it!


Konrad
  • February 1, 2021

@Gleb one more tricky part, how to do it with outlined button state? Any ideas?


Gleb
  • Power Member
  • February 1, 2021

Easy: instead of coloring the central rectangle autolayout, put two horizontal lines in it. And turn sides into strokes, removing two vertical lines from them.


Alexander_Tazh

There should be something like a ‘9 patch’ checkmark for this by the fill value of the autolayouted element.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings