我找不到任何为这样的行设置背景的方法:
我只有一个堆栈来寻找可能的解决方案,但仅适用于一个单元。
谢谢。
编辑:
我关注了@tekkerue answer,但没有得到所需的结果,背景仍然在内部表之外:
我使用像素图作为背景纹理:
Pixmap pixmap = new Pixmap(1,1,Pixmap.Format.RGB565);
pixmap.setColor(color);
pixmap.fill();
您可以使用嵌套表。为每一行创建一个新表,并在行表上设置颜色,而不是主表的颜色。一个基本的例子是:
// main table
Table table = new Table();
// row 1
Table row1 = new Table();
row1.setBackground(blueDrawable);
table.add(row1);
table.row();
// row 2
Table row2 = new Table();
row2.setBackground(greenDrawable);
table.add(row2)
table.row();