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


TypeScript stack-layout.StackLayout類代碼示例

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


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

示例1: createPage

export function createPage() {
    var page = new pageModule.Page();
    var stackLayout = new stackModule.StackLayout();
    var btn1 = new buttonModule.Button();
    btn1.horizontalAlignment = "left";
    btn1.verticalAlignment = "top";
    btn1.marginTop = 10;
    btn1.marginRight = 0;
    btn1.marginBottom = 10;
    btn1.marginLeft = 20;
    btn1.text = "top, left";

    var btn2 = new buttonModule.Button();
    btn2.horizontalAlignment = "center";
    btn2.verticalAlignment = "middle";
    btn2.text = "center, center";

    var btn3 = new buttonModule.Button();
    btn3.horizontalAlignment = "right";
    btn3.verticalAlignment = "bottom";
    btn3.text = "bottom, right";

    var btn4 = new buttonModule.Button();
    btn4.horizontalAlignment = "stretch";
    btn4.verticalAlignment = "stretch";
    btn4.text = "stretch, stretch";

    stackLayout.addChild(btn1);
    stackLayout.addChild(btn2);
    stackLayout.addChild(btn3);
    stackLayout.addChild(btn4);

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

示例2: showReportPage

function showReportPage(finalMessage: string) {
    const stack = new StackLayout();
    const btn = new Button();
    btn.text = "Rerun tests";
    btn.on("tap", () => runAll(testsSelector));
    stack.addChild(btn);

    const messageContainer = new TextView();
    messageContainer.editable = messageContainer.autocorrect = false;
    messageContainer.text = finalMessage;
    stack.addChild(messageContainer);

    topmost().navigate({
        create: () => {
            const page = new Page();
            page.content = stack;
            messageContainer.focus();
            page.style.fontSize = 11;
            if (platform.isAndroid) {
                page.on('navigatedTo', () => {
                    messageContainer.focus();
                    setTimeout(() => messageContainer.dismissSoftInput());
                });
            }

            return page;
        },
        clearHistory: true
    });
}
開發者ID:slavchev,項目名稱:NativeScript,代碼行數:30,代碼來源:testRunner.ts

示例3: test_childNodeRemoved_in_dom_node

export function test_childNodeRemoved_in_dom_node() {
    let childNodeRemovedCalled = false;
    let actualRemovedNodeId = 0;
    let expectedRemovedNodeId = 0;

    currentInspector.childNodeRemoved = (parentId, nodeId) => {
        childNodeRemovedCalled = true;
        actualRemovedNodeId = nodeId;
    }

    const stack = new StackLayout();
    stack.ensureDomNode();

    const btn1 = new Button();
    btn1.text = "button1";
    expectedRemovedNodeId = btn1._domId;
    stack.addChild(btn1);

    const btn2 = new Button();
    btn2.text = "button2";
    stack.addChild(btn2);

    stack.removeChild(btn1);
    console.log("btn2: " + btn2);

    assert(childNodeRemovedCalled, "global.__inspector.childNodeRemoved not called.");
    assertEqual(actualRemovedNodeId, expectedRemovedNodeId);
}
開發者ID:sitefinitysteve,項目名稱:NativeScript,代碼行數:28,代碼來源:dom-node-tests.ts

示例4: createPage

export function createPage() {
    var page = new pages.Page();
    var stack = new stackModule.StackLayout();

    var btn = new button.Button();
    btn.text = "Page C new activity";
    btn.on(button.Button.tapEvent, function () {
        var nextPage = "tests/pages/navigation/pageC-new-activity";
        frame.topmost().navigate(nextPage);
    });
    stack.addChild(btn);

    var backBtn = new button.Button();
    backBtn.text = "BACK";
    backBtn.on(button.Button.tapEvent, function () {
        frame.topmost().goBack();
    });
    stack.addChild(backBtn);

    var txt = new text.TextField();
    txt.text = "text new B";
    stack.addChild(txt);

    page.content = stack;
    return page;
}
開發者ID:NathanWalker,項目名稱:NativeScript,代碼行數:26,代碼來源:pageB-new-activity.ts

示例5: do_PageTest_WithStackLayout_AndButton

export function do_PageTest_WithStackLayout_AndButton(test: (views: [Page, StackLayout, Button, ActionBar]) => void) {
    clearPage();
    let newPage = getCurrentPage();
    let stackLayout = new StackLayout();
    let btn = new Button();
    stackLayout.addChild(btn);
    newPage.content = stackLayout;
    test([newPage, stackLayout, btn, newPage.actionBar]);
    newPage.content = null;
}
開發者ID:m-abs,項目名稱:NativeScript,代碼行數:10,代碼來源:helper.ts

示例6: function

export var test_value_Inherited_stronger_than_Default = function () {
    let page = helper.getCurrentPage();
    let btn = new button.Button();
    let testStack = new stack.StackLayout();
    page.content = testStack;
    testStack.addChild(btn);
    page.css = "stackLayout { color: red; }";
    helper.assertViewColor(btn, "#FF0000");
    page.css = "";
}
開發者ID:sitefinitysteve,項目名稱:NativeScript,代碼行數:10,代碼來源:value-source-tests.ts

示例7: function

export var test_value_Inherited_after_unset = function () {
    let page = helper.getCurrentPage();
    page.css = "StackLayout { color: #FF0000; } .blue { color: #0000FF; }";
    let btn = new button.Button();
    let testStack = new stack.StackLayout();
    page.content = testStack;
    testStack.addChild(btn);
    btn.className = "blue";
    helper.assertViewColor(btn, "#0000FF");
    btn.className = "";
    helper.assertViewColor(btn, "#FF0000");
}
開發者ID:NathanWalker,項目名稱:NativeScript,代碼行數:12,代碼來源:value-source-tests.ts

示例8: createPage

export function createPage() {
    function createTxt(text: string) {
        var tv = new textView.TextView();
        tv.text = text;
        return tv;
    }

    var page = new pages.Page();
    var scrollView = new scroll.ScrollView();

    function performGet() {
        console.log("Getting CSS");
        http.getString("http://192.168.54.36:8080/test.css").then(
            function (r) {
                console.log("Applying CSS");
                page.css = r;
                timer.setTimeout(performGet, 1000);
            },
            function (e) {
                console.log("Error: " + e);
                timer.setTimeout(performGet, 1000);
            });
    }

    var stack = new stacks.StackLayout();
    scrollView.content = stack;

    var counter = 0;
    var btn = new btns.Button();
    btn.text = "tap";
    btn.on(btns.Button.tapEvent, function () {
        btn.text = "hi: " + counter++;
    });
    btn.isEnabled = false;

    stack.addChild(btn);
    stack.addChild(createTxt("this is label"));

    var info = new btns.Button();
    info.text = "info";
    info.className = "info";
    info.on(btns.Button.tapEvent, function () {
        info.text = "hi: " + counter++;
        btn.isEnabled = true;
    });
    stack.addChild(info);

    stack.addChild(createTxt("this is another label"));

    page.content = scrollView;
    timer.setTimeout(performGet, 2000);
    return page;
}
開發者ID:NathanWalker,項目名稱:NativeScript,代碼行數:53,代碼來源:page8.ts

示例9: createPage

export function createPage() {
    var page = new pageModule.Page();

    //var iconItem = new pageModule.MenuItem();
    //iconItem.text = "TEST";

    //iconItem.icon = "~/app" + "/tests" + "/test-icon.png"; // use + to stop regex replace during build
    //iconItem.on("tap", () => {
    //    console.log("Icon item tapped");
    //});
    //page.optionsMenu.addItem(iconItem);

    //var textItem = new pageModule.MenuItem();
    //textItem.text = "SAVE";
    //textItem.on("tap", () => {
    //    console.log("Save item tapped");
    //});
    //page.optionsMenu.addItem(textItem);

    var stackLayout = new stackModule.StackLayout();
    //var count = 0;
    var btn1 = new buttonModule.Button();
    btn1.text = "add item";
    //btn1.on("tap", () => {
    //    console.log("adding menu item");

    //    var newItem = new pageModule.MenuItem();
    //    var text =  "item " + count;
    //    newItem.text = text
    //    newItem.on("tap", () => {
    //        console.log("ITEM [" + text + "] tapped");
    //    });
    //    page.optionsMenu.addItem(newItem);
    //    count++;
    //});

    stackLayout.addChild(btn1);

    var btn2 = new buttonModule.Button();
    btn2.text = "navigate";
    btn2.on("tap", () => {
        var nextPage = "app/tests/pages/page16";
        frame.topmost().navigate(nextPage);
    });

    stackLayout.addChild(btn2);

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


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