mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import * as pageModule from "tns-core-modules/ui/page";
|
|
import * as buttonModule from "tns-core-modules/ui/button";
|
|
import * as stackModule from "tns-core-modules/ui/layouts/stack-layout";
|
|
|
|
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;
|
|
}
|