Back

CreateLayout

Hello World
Content:
- Card Layouts

It is just the CreateLayout method of DroidScript with predefined values on background color just to be consistent on MUI theming.

lay = MUI.CreateLayout( type, options ) → Object

It is highly recommended to use this method instead of directly calling CreateLayout from the app object.

Example - Just Layout

cfg.Light
cfg.MUI

function OnStart()
{
    color = MUI.colors.teal
    app.InitializeUIKit(color.teal)

    lay = MUI.CreateLayout("Linear", "VCenter,FillXY")

        txt = MUI.CreateTextParagraph("DroidScript is awesome!")
        lay.AddChild(txt)

    app.AddLayout(lay)
}
Copy All       Run      

Card Layouts

Card layout is ligter than other types of layouts to make it appear as a primary focus on a page.

Example - Dark Layout with Card

cfg.Dark
cfg.MUI

function OnStart()
{
    color = MUI.colors.teal
    app.InitializeUIKit(color.teal)

    lay = MUI.CreateLayout("Linear", "VCenter,FillXY")

        cardLay = MUI.CreateLayout("Card")
        cardLay.SetSize(0.85, 0.25)
        lay.AddChild(cardLay)

    app.AddLayout(lay)
}
Copy All       Run      

Since it returns a DroidScript layout object, you can use all the layout methods you know.

String: “Linear” or “Absolute” or “Frame” or “Card”
String: “Comma separated DroidScript layout options”