Tip:
Highlight text to annotate it
X
hi guys welcome to the second tutorial
of the second part of gazman sdk today we will continue to learn about
layouts and learn about align layout
at the previous tutorial we created background
top bar, bottom bar and and used the container layout
to position it on the screen, this how its looks like
now I want to add additional component
title and place it below the top bar
so lets do it Its going to be
a text field
let's make it 300
over 16
and the label: I love layouts!(Me too)
Ofcourse Alright
lets add it to the stage
and now lets create the align layout
now I want to make it, below 10 pixels
so apply layout
(Turututu) Oh sorry. On the title
and the relative to is
is who we want to place it below to. So we we want to place it below the
top bar. And thats it
Lets run it
Here our title and its below the top bar.
But what if I also want to place it in the center So...
I can use the container layout for this. Lets ask the container layout
To apply the same layout that we applied
on the button bar.
Now I am applying it on the title. Relative to parent.
Or relative to the background, it doesn't metter
and let's run it And
Here it is in the center, Which is a bit weird
because we usked the container layout
to be in the position of 20 pixels from the bottom
Which manipulates the y coordination
Of our target. In our case its title
but so is the align layout when we set the property "below" to 10 pixels
It also manipulate the y coordination of
the title So once we placed it in the bottom
And the we fixed it and place it in the top
below the top bar just like we wanted to. You can make
a lots of games with container layou
And align layout. And in the next tutorial
you will also learn about the
Linear Layout(Cool!)
thank you for working and please subscribe.