This Lesson is for Members

Subscribe today and get access to all lessons! Plus direct HD download for offline use, enhances transcripts, member comment forums, and iTunes "podcast" RSS feed. Level up your skills now!

Unlock This Lesson

Already subscribed? Sign In

Autoplay

    Create an Absolute Positioned Layout Using AbsoluteLayout

    Brad MartinBrad Martin

    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.

    nativescriptNativeScript
    >2.5.0 <4.2.0
    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Transcript

    Transcript

    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.

    Discuss

    Discuss