I have the following wireframe:
I need to add the "Don't have an account yet? Sign Up.". To do this I'll have two different UILabels, one with "Don't have an account yet?" and another with "Sign Up" so I can style them separately.
My problem is that I don't know how to center to the Superview two different labels that have different size and my grow if it's localized to a language where they take more space than english...
So the questions would be: "How do I center two UILabels with different width related to it's superview?"
Thanks a lot!
To horizontally center multiple inner divs (in a row) in outer div using CSS, follow these instructions. Set text-align attribute for outer div as center. Make sure the inner divs are inline blocks. Example
To horizontally center a block element (like <div>), use margin: auto; Setting the width of the element will prevent it from stretching out to the edges of its container.
Instead of layout_gravity you have to use the properties layout_centerHorizontal, layout_centerVertical and layout_centerInParent (which centers both horizontally and vertically). The FrameLayout has no gravity property.
I am vertically centered. To center both vertically and horizontally, use padding and text-align: center: I am vertically and horizontally centered. Another trick is to use the line-height property with a value that is equal to the height property:
Here is the steps:
Here is the visual presentation of it...
You should put them into container UIView make it flexible width (for ex. >= 10) and center it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With