首页 文章

texttooltip没有显示按钮 . (LIBGDX)

提问于
浏览
0

我已经编码了一个带有texttooltip的按钮,但悬停时没有显示工具提示 . 按钮可见且可点击 . 为什么我的工具提示没有显示按钮?

我在ApplicationAdapter.create()中有以下代码:

TextButton textButton = new TextButton("The Button", skin);
    textButton.addListener(new TextTooltip("This is the tip ! Why it is not shown ?", skin));
    textButton.setPosition(300,100);
    stage.addActor(textButton);

    Gdx.input.setInputProcessor(stage);

*** UPDATE ***

我错了 . 它显示了工具提示,但仅在5秒后,我认为它不起作用 . 有没有办法固定弹出窗口?你怎么会立即弹出?用窗户?

1 回答

  • 0

    TextTooltip 有一个构造函数,您可以在其中给出 ToolptipManager .

    TooltipManager 中,在调用此方法后,您有一个函数 instant() ,即可立即显示工具提示 .
    https://libgdx.badlogicgames.com/ci/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/TooltipManager.html

    这是一个立即出现的工具提示示例:

    TextButton textButton = new TextButton("The Button", skin);
    TooltipManager tooltipManager = new TooltipManager();
    tooltipManager.instant();
    textButton.addListener(new TextTooltip("This is the tip ! Why it is not shown ?", tooltipManager, skin));
    textButton.setPosition(0,0);
    textButton.setSize(5,5);
    stage.addActor(textButton);
    
    Gdx.input.setInputProcessor(stage);
    

相关问题