Back

AddLayout

JS Py
Hello World

AddLayout adds a layout to the screen so that it is visible (if not hidden with SetVisibility)
When CreateLayout arguments are passed it will create the layout just like app.CreateLayout and also add it.

app.AddLayout( layout, type?, options? ) → app object: Layout

See Also: RemoveLayout

Example - Vertical

function OnStart()
{
    lay = app.CreateLayout( "Linear", "FillXY,VCenter" );

    txt = app.CreateText( "Hello" );
    txt.SetTextSize( 50 );
    lay.AddChild( txt );

    app.AddLayout( lay );
}
from native import app

def OnStart():
    lay = app.CreateLayout( "Linear", "FillXY,VCenter" )

    txt = app.CreateText( "Hello" )
    txt.SetTextSize( 50 )
    lay.AddChild( txt )

    app.AddLayout( lay )
    Copy     Copy All       Run      
String: “Linear” or “Absolute” or “Frame” or “Card”
String: comma “,” separated: TouchThrough, TouchSpy, “Left” or “Top” or “Right” or “Bottom” or “Center” or “H/VCenter”, “Wrap”, “Horizontal” or “Vertical”, “FillX/Y”
app object: Layout