【问题标题】:My dialog is not showing我的对话框没有显示
【发布时间】:2014-09-23 17:34:46
【问题描述】:

使用UITest on git 我正在构建一个用户界面。但是弹出对话框没有显示,至少我认为它是一个弹出对话框窗口。在这里我设置了应该打开它的按钮:

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

这是附加到它的监听器:

    iconButton.addListener(new ChangeListener() 
    {
        public void changed (ChangeEvent event, Actor actor) 
        {
            new Dialog("Some Dialog", skin, "dialog") 
            {
                protected void result (Object object) 
                {
                    System.out.println("Chosen: " + object);
                }
            }.text("Are you enjoying this demo?").button("Yes", true).button("No", false).key(Keys.ENTER, true)
                .key(Keys.ESCAPE, false).show(stage);
        }
    });

按钮本身工作正常,当我单击并按住它时它会翻转但当我释放此对话框时停止运行(可能是因为其他对话框需要注意)。我可以按 enter/ESC 并在控制台中得到相应的结果(Chosen: true/Chosen: false)。但是我无法退出,因为我看不到实际的对话框。

我没有使用git example 中的所有内容,例如密码框和下拉菜单。我还将它作为一个独立的类来实现,并且只是将它创建为根类中的一个对象。我看不出有什么问题,但话说回来,我知道什么:)?

【问题讨论】:

    标签: java android libgdx scene2d


    【解决方案1】:

    发现问题,无法解决,因为问题目前陈述:

    //I had this in my render method:
    stage.act(Math.min(Gdx.graphics.getDeltaTime(), 1/30));
    //Should be
    stage.act(Math.min(Gdx.graphics.getDeltaTime(), 1/30f));
    //Otherwise it would always be 0, and i guess that would pause the whole stage.
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-04-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多