这对于手机来说是一个糟糕的布局,而且在平板电脑中也会显得局促。话虽如此,表格布局非常简单。您也可以使用 GUI 构建器,但我认为表格布局会更容易,您只需要了解跨越。我为此实施了一种方法,但没有完成整个事情,因为它需要一些工作。您还可以使用其他方法,例如明确给出行/列约束等...
// creates the first row of tables and the second row table
for(int iter = 0 ; iter < 9 ; iter++) {
// this method should create the container with the blue box around it
hi.add(createBox());
}
// I use a blank label as a "filler" and span it over the rest of the row
hi.add(tl.createConstraint().horizontalSpan(7), new Label());
// 3rd row box and spacing
hi.add(createBox());
hi.add(new Label());
// 3rd row boxes and first box of 4th row
for(int iter = 0 ; iter < 7 ; iter++) {
hi.add(createBox());
}
hi.add(new Label());
hi.add(createBox());
// this would place the container with the content in the center
hi.add(tl.createConstraint().
horizontalSpan(4).verticalSpan(6), createContent());
hi.add(createBox());
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句