【问题标题】:Scaled Image actor in Table Layout doesn't expand cell表格布局中的缩放图像演员不展开单元格
【发布时间】:2014-03-24 16:36:45
【问题描述】:

抱歉标题太长了:)

假设我有一个像这样创建的 Image Actor:

Image image = new Image(texture);
image.setScale(2);

将其添加到表格中可以正常显示,但图像的缩放不会扩大表格的大小。

table.add(image);
table.add(anotherimage);
//these images are now overlapping because 'image' is too large for its cell

这是一个已知问题吗,有什么办法可以解决吗?

【问题讨论】:

  • 尝试设置图片的宽高
  • 你试过了吗?这也不起作用。

标签: libgdx scene2d


【解决方案1】:

尝试设置图像单元格的宽度/高度,使其适合表格。

【讨论】:

  • 实际上,我只需要设置图像单元格的宽度和高度。如果你想更新你的答案,我可以接受。
【解决方案2】:
table.add(image).fill().expand();

fill() 用于填充单元格的图像。

expand() 用于使单元格在可用空间上扩展。

【讨论】:

    猜你喜欢
    • 2013-01-22
    • 2020-06-30
    • 2013-06-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-30
    • 1970-01-01
    • 2013-01-14
    相关资源
    最近更新 更多