forked from NativeScript/NativeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainPage.ts
More file actions
49 lines (42 loc) · 1.52 KB
/
mainPage.ts
File metadata and controls
49 lines (42 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import pagesModule = require("ui/page");
import enums = require("ui/enums");
import stackLayoutModule = require("ui/layouts/stack-layout");
import buttonModule = require("ui/button");
import labelModule = require("ui/label");
import textFieldModule = require("ui/text-field");
import textViewModule = require("ui/text-view");
import colorModule = require("color");
export function createPage() {
var width = 200;
var textAlignment = enums.TextAlignment.right;
var stack = new stackLayoutModule.StackLayout();
var view;
view = new buttonModule.Button();
view.width = width;
view.style.backgroundColor = new colorModule.Color("Blue");
view.style.textAlignment = textAlignment;
view.text = "Button";
stack.addChild(view);
view = new labelModule.Label();
view.width = width;
view.text = "Label";
view.style.backgroundColor = new colorModule.Color("Green");
view.style.textAlignment = textAlignment;
stack.addChild(view);
view = new textFieldModule.TextField();
view.width = width;
view.text = "TextField";
view.style.backgroundColor = new colorModule.Color("Yellow");
view.style.textAlignment = textAlignment;
stack.addChild(view);
view = new textViewModule.TextView();
view.width = width;
view.text = "TextView";
view.style.backgroundColor = new colorModule.Color("Red");
view.style.textAlignment = textAlignment;
stack.addChild(view);
var page = new pagesModule.Page();
page.content = stack;
return page;
}
//export var Page = page;