Skip to content

HStackDemo.llua

xu.jingyu edited this page Aug 11, 2020 · 2 revisions

copy下面代码,运行试试

mLabel(str, bgColor) {
    Label(str)
    .textColor(Color(255, 255, 255, 0.8))
    .padding(3, 5, 3, 5)
    .bgColor(bgColor)
    .fontSize(10)
}
---
--- UI
ui {
    --- layout views
    HStack().height(50)
    .widthPercent(100)
    .bgColor(Color(220, 230, 200, 1))
    .subs(
        mLabel("0元配送", Color(100, 100, 200, 0.8))
        ,
        mLabel("支持自取", Color(100, 120, 200, 0.8))
        ,
        mLabel("食无忧", Color(140, 120, 200, 0.8))
        ,
        mLabel("津贴2元", Color(180, 150, 100, 0.8))
        .positionType(PositionType.RELATIVE)
        .positionLeft(10)
        .positionTop(10)
        ,
        mLabel("会员专享", Color(180, 100, 100, 0.8))
        ,
        mLabel("首单立减", Color(150, 60, 100, 0.8))
    )
}.safeArea(SafeArea.TOP)

---
--- preview
local function preview()
end
Clone this wiki locally