本文整理汇总了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;未经允许,请勿转载。 |
请发表评论