Absolute layout

The absolute layout is similar to the absolute positioning that's done in CSS. The child elements are positioned at the top-left coordinates of the page:

<AbsoluteLayout>
<Label text="Start from top left" width="100%" top="10"
height="90" backgroundColor="yellow"></Label>
<Label text="Start from below the above element" width="100%"
top="110" height="90" backgroundColor="red" color="white"></Label>
</AbsoluteLayout>

The preceding code will produce the following layout:

In the preceding example, we have two label elements positioned absolutely to each other. The first element starts from the top 10 pixels and 10 pixels from the left. The second element starts 110 pixels from the top and 10 pixels from the left.

AbsoluteLayout is the simplest layout in NativeScript. It will not enforce any layout constraints on its children and will not resize them at runtime when its size changes. Now, let's look at how the dock layout works in NativeScript.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.13.173