【发布时间】:2017-12-17 17:59:13
【问题描述】:
我想知道这是一个错误还是我的错误代码。我一直在尝试用一些水平跨越来渲染表格。它应该是这样的:
在 LWUIT 1.4 中一切正常。从 1.5 开始,表格如下所示:
我的实现:
DefaultTableModel model = new DefaultTableModel(new String[]{"", "", "", ""}, new String[][]{
{"Header", null, null, null},
{"1", "2", "3", "4"},
{"1", "2", "3", "4"},
{"String", null, "String", null}});
Table tab = new Table(model, false) {
protected Component createCell(Object value, final int row, final int column, boolean editable) {
Component c = super.createCell(value, row, column, editable);
c.setFocusable(false);
return c;
}
protected TableLayout.Constraint createCellConstraint(java.lang.Object value, int row, int column) {
TableLayout.Constraint tlay = super.createCellConstraint(value, row, column);
if (row == 0 && column == 0) {
tlay.setHorizontalSpan(4);
tlay.setHorizontalAlign(Table.CENTER);
} else if (row == 3)) {
if (column == 0) {
tlay.setHorizontalSpan(2);
tlay.setWidthPercentage(50);
} else if (column == 2) {
tlay.setHorizontalSpan(2);
tlay.setWidthPercentage(50);
}
} else if (row != 0) {
tlay.setWidthPercentage(25);
}
return tlay;
}
};
【问题讨论】:
-
嗨,如何删除表格模型中的边框线。我用过 (Tabel table.getStyle().setBorder(null);)。它只去除边界线,而不是单元格边界。
标签: java-me tablelayout lwuit