Libgdx scene2d演员随机出现并淡出

inn*_*nat 4 java libgdx scene2d

所以我有一个像这样的sceneu2.ui表:

+--------------------------------------+
|+---------+ +------------+ +---------+|
|| Table 1 | | ScrollPane | | Table 2 ||
|+---------+ +------------+ +---------+|
+--------------------------------------+
|                             My Actor |
+--------------------------------------+
Run Code Online (Sandbox Code Playgroud)

里面scrollpane是另一个table.外壳也是一个table.Table 1,Table 2并且table里面scrollpane有相同数量的行.

My Actor 是简单的图像按钮actor,也支持鼠标悬停.

问题是,My Actor最初没有出现(但是它的边​​界存在 - 由表调试行检查)但是当我滚动某些东西scrollpane(用鼠标)时它会出现2秒钟,然后开始逐渐消失.(预期结果应始终显示)

我究竟做错了什么?


My Actor类:

public class GameButton extends Actor {
    public static abstract class Listener {
        public abstract void onClick();
    }

    final Texture[] current;
    final Listener listener;
    boolean disabled;
    int state = 0;

    public GameButton(Texture[] current, final Listener listener) {
        this.current = current;
        setWidth(current[0].getWidth());
        setHeight(current[0].getHeight());

        this.listener = listener;
        disabled = false;

        this.addListener(new InputListener() {
            boolean just_up = false;

            @Override
            public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
                state = 2;
                return true;
            }

            @Override
            public void touchUp (InputEvent event, float x, float y, int pointer, int button) {
                state = 0;
                if (hit(x, y, false) != null) {
                    just_up = true;
                    state = 1;
                    if (listener != null && !disabled)
                        listener.onClick();
                }
            }

            @Override
            public void enter (InputEvent event, float x, float y, int pointer, Actor fromActor) {
                if (state == 0)
                    state = 1;
            }

            @Override
            public void exit (InputEvent event, float x, float y, int pointer, Actor toActor) {
                if (!just_up)
                    state = 0;
                just_up = false;
            }
        });
    }

    public void setDisabled(boolean disabled) {
        this.disabled = disabled;
    }

    @Override
    public void draw(SpriteBatch batch, float _) {
        super.draw(batch, _);
        batch.draw(current[disabled ? 0 : state], getX(), getY(), getWidth(), getHeight());
    }
}
Run Code Online (Sandbox Code Playgroud)

用于将其添加到表的代码:

    btnBack = new GameButton(Assets.btnBack, 0, 0, new GameButton.Listener() {
        @Override
        public void onClick() {
            /* removed */
        }
    });
    add(btnBack).colspan(3).right().bottom().height(128);
Run Code Online (Sandbox Code Playgroud)

Muc*_*ewe 5

我意识到这个问题是2岁,但我也有这个问题所以我想发布我的解决方案.对我来说,这只是将滚动条淡入淡出为假的情况

ScrollPane scroll = new ScrollPane();
scroll.setFadeScrollBars(false);
Run Code Online (Sandbox Code Playgroud)