⚠️ This lesson is retired and might contain outdated information.

Create an Absolute Positioned Layout Using AbsoluteLayout

Brad Martin
InstructorBrad Martin
Share this video with your friends

Social Share Links

Send Tweet
Published 8 years ago
Updated 2 years ago

We will use the AbsoluteLayout component to create a layout container which uses left-top coordinates to position its child components in a NativeScript app.

[00:00] Start by adding an absolute layout to your page. Inside of the absolute layout, we'll add a few view components. First, we'll add a button with the text set to hello. We need to set the left and top coordinates, so we'll use left set to 10 and top set to 100.

[00:30] We'll add another button with the text set to goodbye and the left position set to 140 and the top position to 250. Last, let's add a label with the text of Egghead and the left value set to 60 and the top set to 400. When we run this, these view components will be positioned absolute by their top left coordinates.

[01:06] Here they are. The hello button is positioned 10 from the left and 100 from the top of the view. The goodbye button is positioned 140 from the left and 250 from the top. Last, your Egghead label is 60 from the left and 400 from the top of the page.