你好,我有一个关于表布局的问题:在这段代码中,我得到了两个表之间奇怪的空格。
public class ItemList extends Table {
private final float TABLE_PADDING = 5.0f;
private Table layout;
private Array<Image> images = new Array<Image>();
public ItemList(Skin skin) {
super(skin);
this.setBackground("bg_dark_grey");
layout = new Table(skin);
TextField itemSearch = new TextField("", skin);
itemSearch.setMessageText("Search");
this.add(itemSearch).pad(TABLE_PADDING).fillX().row();
ScrollPane scrollPane = new ScrollPane(layout, skin);
this.add(scrollPane);
}
public void addItems(TextureAtlas items) {
// Add a cell to layout for every image.
}
}
}发布于 2015-09-07 03:01:51
首先使用debug()查看表的边界
...
super(skin);
this.setBackground("bg_dark_grey");
this.debug();
...
layout = new Table(skin);
layout.debug();
...其次,我非常确定添加到itemSearch中的pad会生成空格-请检查
https://stackoverflow.com/questions/32424693
复制相似问题