LWUIT 1.5 Table - horizontal spanning problem
Translations
Englishالعربية
български
català
中文
čeština
dansk
Nederlands
eesti
suomi
français
Deutsch
Ελληνικά
עברית
हिंदी
magyar
Bahasa Indonesia
italiano
日本語
한국어
latviešu
lietuvių
norsk
polski
Português
română
русский
slovenčina
slovenski
español
svenska
ไทย
Türkçe
українська
Tiếng Việt
I am wondering if this is a bug or just my faulty code. I've been trying to render table with some horizontal spanning. This is how it should look like:

In LWUIT 1.4 everything worked correctly. Since 1.5 the table looks like:

My implementation:
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;
}
};
This question and answers originated from www.stackoverflow.com
Question by hajhet (8/15/2011 10:12:02 PM)
Answer |
The bug (in LWUIT) is triggered by the tlay.setWidthPercentage(50); which you can remove and still get the expected result. It seems the width percentage value doesn't take spanning into consideration which I'm guessing it should.
You should file a bug for this in the issue tracker, thanks for the bug.
Answer by Shai Almog
Find More Answers