【发布时间】:2014-08-11 19:21:46
【问题描述】:
是否可以在不使用 CSS 的情况下修改表面的内容(在 GridLayout 中使用)?例如将文本居中?
基本示例:
function createGrid( section, dimensions, menuData ) {
var grid = new GridLayout({
dimensions: dimensions
});
var surfaces = [];
grid.sequenceFrom(surfaces);
for(var i = 0; i < dimensions[1]; i++) {
surfaces.push(new Surface({
content: menuData[i].title,
size: [undefined, undefined],
properties: {
backgroundColor: "#ff0000",
color: "white",
textAlign: 'center',
}
}));
}
return grid;
}
我添加了 center 属性,但我也想让内容位于我的表面中间。我必须使用 CSS 还是有其他方法? 我尝试在这个 Surface 中添加另一个 View/Surface 并添加了 align/origin 修改器。没用:我仍然需要调整特定(浏览器)布局的原点/对齐值...
【问题讨论】: