【问题标题】:ImageButton not appearing on the screen in libgdxImageButton 没有出现在 libgdx 的屏幕上
【发布时间】:2014-09-07 16:32:54
【问题描述】:

我想让一个图像按钮出现在面板中,但没有绘制。

这是我的代码:

skin = new Skin(Gdx.files.internal("uiskin.json"));
texture1 = new Texture(Gdx.files.internal("badlogicsmall.jpg"));
texture2 = new Texture(Gdx.files.internal("badlogic.jpg"));
TextureRegion image = new TextureRegion(texture1);
TextureRegion imageFlipped = new TextureRegion(image);
imageFlipped.flip(true, true);
TextureRegion image2 = new TextureRegion(texture2);

ImageButtonStyle style = new ImageButtonStyle(skin.get(ButtonStyle.class));
style.imageUp = new TextureRegionDrawable(image);
style.imageDown = new TextureRegionDrawable(imageFlipped);
ImageButton iconButton = new ImageButton(style);
style.imageUp = new TextureRegionDrawable(image);
style.imageDown = new TextureRegionDrawable(imageFlipped);

感谢任何帮助!

提前致谢!

【问题讨论】:

    标签: android libgdx panel android-imagebutton


    【解决方案1】:

    我会尝试猜测...您是否以某种方式将 ImageButton 添加到舞台? (假设您使用的是一个)。

    如果您有舞台,我建议您将表格添加到舞台(使用 addActor),然后将此 ImageButton 添加到表格(使用 add)。

    【讨论】:

      猜你喜欢
      • 2013-12-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-01
      • 1970-01-01
      相关资源
      最近更新 更多