当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript StackLayout.addChild方法代码示例

本文整理汇总了TypeScript中ui/layouts/stack-layout.StackLayout.addChild方法的典型用法代码示例。如果您正苦于以下问题:TypeScript StackLayout.addChild方法的具体用法?TypeScript StackLayout.addChild怎么用?TypeScript StackLayout.addChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ui/layouts/stack-layout.StackLayout的用法示例。


在下文中一共展示了StackLayout.addChild方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: constructor

    constructor() {
        this.tabviewitems = [];

        let innerFirstStackLayout = new StackLayout();
        let firstLabel = new Label();
        firstLabel.margin = "15";
        firstLabel.text = "Label first page";
        innerFirstStackLayout.addChild(firstLabel);

        let innerSecondStackLayout = new StackLayout();
        let secondLabel = new Label();
        secondLabel.margin = "15";
        secondLabel.text = "Label second page";
        innerSecondStackLayout.addChild(secondLabel);

        let innerThirdStackLayout = new StackLayout();
        let thirdLabel = new Label();
        thirdLabel.margin = "15";
        thirdLabel.text = "Label third page";
        innerThirdStackLayout.addChild(thirdLabel);

        this.tabviewitems.push({ "title": "Tab1", "view": innerFirstStackLayout });
        this.tabviewitems.push({ "title": "Tab2", "view": innerSecondStackLayout });
        this.tabviewitems.push({ "title": "Tab3", "view": innerThirdStackLayout });

    }
开发者ID:aymenbraiek,项目名称:nativescript-sdk-examples-ng,代码行数:26,代码来源:tab-view-items.component.ts

示例2: createPage

export function createPage() {
    var StackLayout = require("ui/layouts/stack-layout").StackLayout;
    var Image = require("ui/image").Image;

    var stack = new StackLayout();
    var grid = new gridModule.GridLayout();

    grid.addColumn(new gridModule.ItemSpec(1, gridModule.GridUnitType.auto));
    grid.addColumn(new gridModule.ItemSpec(1, gridModule.GridUnitType.star));

    grid.addRow(new gridModule.ItemSpec(1, gridModule.GridUnitType.auto));
    grid.addRow(new gridModule.ItemSpec(1, gridModule.GridUnitType.star));

    var sldr = new slider.Slider();
    gridModule.GridLayout.setColumnSpan(sldr, 2);
    sldr.maxValue = 500;
 
    stack.addChild(sldr);
    stack.addChild(grid);

    var image = new Image();
    image.stretch = enums.Stretch.fill;
    image.verticalAlignment = 2;
    image.horizontalAlignment = 1;

    image.source = imageSource.fromFile(__dirname + "test.png");
    grid.addChild(image);

    var page = new pages.Page();
    page.content = stack;
    page.css = "GridLayout { background-color: pink } image { background-color: green }";
    return page;
}
开发者ID:DamonWang1991,项目名称:NativeScript,代码行数:33,代码来源:page9.ts

示例3: addDropShadow

	public static addDropShadow(translateY: number, width: number): StackLayout {
		let wrapper = new StackLayout();
		wrapper.width = width;
		wrapper.height = 3;
		wrapper.translateY = translateY;
		wrapper.addChild(this.shadowView(0.4, width));
		wrapper.addChild(this.shadowView(0.2, width));
		wrapper.addChild(this.shadowView(0.05, width));
		return wrapper;
	}
开发者ID:TheOriginalJosh,项目名称:nativescript-parallax,代码行数:10,代码来源:utilities.ts

示例4: addDropShadow

	public static addDropShadow(marginTop: number, width: number): StackLayout {
		let wrapper = new StackLayout();
		wrapper.width = width;
		wrapper.height = 3;
		wrapper.marginTop = marginTop;
		wrapper.addChild(this.shadowView(0.4, width));
		wrapper.addChild(this.shadowView(0.2, width));
		wrapper.addChild(this.shadowView(0.05, width));
		return wrapper;
	}
开发者ID:katturajam,项目名称:nativescript-parallax,代码行数:10,代码来源:utilities.ts

示例5: ngOnInit

    ngOnInit() {
        let stackView: StackLayout = this.stack.nativeElement;

        this.newImage = new Image();
        this.newImage.imageSource = ImageSourceModule.fromResource("icon");
        this.newImage.stretch = "none";
        this.newImage.style.margin = "15";

        this.newLabel = new Label();
        this.newLabel.text = "Image loaded from code behind";
        this.newLabel.style.margin = "15";

        stackView.addChild(this.newLabel);
        stackView.addChild(this.newImage);
    }
开发者ID:aymenbraiek,项目名称:nativescript-sdk-examples-ng,代码行数:15,代码来源:creating-image.component.ts

示例6: createView

	function createView() {
		const page = new Page();
		const layout = new StackLayout();
		page.content = layout;

		const label = new Label();
		label.text = scan.content;
		label.className = "details-content";
		layout.addChild(label);

		const date = new Label();
		date.text = scan.date.toLocaleString('en');
		layout.addChild(date);

		if (callback) {
			const button = new Button();
			button.text = "Open";
			button.on("tap", callback);
			layout.addChild(button);
		}

		return page;
	}
开发者ID:PacktPublishing,项目名称:TypeScript-Blueprints,代码行数:23,代码来源:details.ts

示例7: createPage

export function createPage() {
    var StackLayout = require("ui/layouts/stack-layout").StackLayout;
    var Label = require("ui/label").Label;
    var Image = require("ui/image").Image;

    var stack = new StackLayout();
    var grid = new gridModule.GridLayout();
    stack.addChild(grid);

    grid.addColumn(new gridModule.ItemSpec(80, "pixel"));
    grid.addColumn(new gridModule.ItemSpec(1, "star"));
    grid.addRow(new gridModule.ItemSpec(1, "auto"));
    grid.addRow(new gridModule.ItemSpec(1, "auto"));

    var defaultImageSource = imageSource.fromFile(__dirname + "/test.png");

    var img = new Image();
    img.source = defaultImageSource;

    img.width = 80;
    img.height = 80;
    img.verticalAlignment = enums.VerticalAlignment.bottom;
    gridModule.GridLayout.setRowSpan(img, 2);
    grid.addChild(img);

    var titleLabel = new Label();
    titleLabel.textWrap = true;
    titleLabel.text = "some text goes here";
    gridModule.GridLayout.setColumn(titleLabel, 1);
    grid.addChild(titleLabel);

    var commentsLabel = new Label();
    commentsLabel.text = "comments";
    commentsLabel.verticalAlignment = enums.VerticalAlignment.bottom;
    gridModule.GridLayout.setRow(commentsLabel, 1);
    gridModule.GridLayout.setColumn(commentsLabel, 1);
    grid.addChild(commentsLabel);

    var page = new pages.Page();
    page.content = stack;
    page.css = "GridLayout { background-color: yellow } image { background-color: green } label { background-color: red } stackpnael { background-color: pink }";
    return page;
}
开发者ID:NathanWalker,项目名称:NativeScript,代码行数:43,代码来源:page10.ts

示例8: loginPageFunc

    public loginPageFunc() {
        let wv = new TnsOauthWebView(this._cancelEventHandler);

        TnsOAuthWebViewHelper.initWithWebViewAndIntercept(wv, this._checkCodeIntercept);

        let grid = new GridLayout();
        grid.addChild(wv);

        let stack = new StackLayout();
        stack.addChild(grid);

        let page = new Page();
        page.content = stack;

        if (isAndroid) {
            page.actionBarHidden = true;
        }

        wv.src = this._authUrl;

        return page;
    };
开发者ID:alexziskind1,项目名称:nativescript-oauth,代码行数:22,代码来源:tns-oauth-page-provider.ts


注:本文中的ui/layouts/stack-layout.StackLayout.addChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。