當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript GridLayout.setColumnSpan方法代碼示例

本文整理匯總了TypeScript中tns-core-modules/ui/layouts/grid-layout.GridLayout.setColumnSpan方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript GridLayout.setColumnSpan方法的具體用法?TypeScript GridLayout.setColumnSpan怎麽用?TypeScript GridLayout.setColumnSpan使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tns-core-modules/ui/layouts/grid-layout.GridLayout的用法示例。


在下文中一共展示了GridLayout.setColumnSpan方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: createPage

export function createPage() {
    var page = new pages.Page();
    var gridLayout = new gridLayoutModule.GridLayout();

    var lengths = [
        new gridLayoutModule.ItemSpec(140, "pixel"),
        new gridLayoutModule.ItemSpec(1, "star"),
        new gridLayoutModule.ItemSpec(140, "pixel")
    ];

    var rows = 2;
    var cols = 3;
    var row;
    var col;

    for (row = 0; row < rows; row++) {
        var rowDef = new gridLayoutModule.ItemSpec(1, "auto");
        gridLayout.addRow(rowDef);
    }

    for (col = 0; col < cols; col++) {
        gridLayout.addColumn(lengths[col]);
    }

    var btn = new btns.Button();
    btn.text = "Col: 0";
    gridLayoutModule.GridLayout.setColumn(btn, 0);
    gridLayoutModule.GridLayout.setRow(btn, 0);
    gridLayout.addChild(btn);

    var btn2 = new btns.Button();
    btn2.text = "Col: 2";
    gridLayoutModule.GridLayout.setColumn(btn2, 2);
    gridLayoutModule.GridLayout.setRow(btn2, 0);
    gridLayout.addChild(btn2);

    var txt = new tb.TextField();
    txt.text = "Col: 1";
    txt.width = 140;
    gridLayoutModule.GridLayout.setColumn(txt, 1);
    gridLayoutModule.GridLayout.setRow(txt, 0);
    gridLayout.addChild(txt);

    var txt2 = new tb.TextField();
    txt2.text = "Col: All";
    gridLayoutModule.GridLayout.setColumnSpan(txt2, 3);
    gridLayoutModule.GridLayout.setRow(txt2, 1);
    gridLayout.addChild(txt2);

    page.content = gridLayout;
    return page;
}
開發者ID:NathanWalker,項目名稱:NativeScript,代碼行數:52,代碼來源:page12.ts


注:本文中的tns-core-modules/ui/layouts/grid-layout.GridLayout.setColumnSpan方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。