【发布时间】:2016-10-18 04:23:01
【问题描述】:
我想要一个具有 3D 效果的按钮,所以如果你按下它,它看起来就像是按下了按钮(在“地面”内)。
但我想保存文件大小,只保存没有文字的背景纹理。所以我正在使用 TextButtons 并尝试检测按钮是否像这样“按住”:
tbs1 = new TextButton.TextButtonStyle();
tbs1.up = new TextureRegionDrawable(Game.res.getAtlas("buttons_3").findRegion("button3_green_normal"));
tbs1.down = new TextureRegionDrawable(Game.res.getAtlas("buttons_3").findRegion("button3_green_pressed"));
tbs1.font = FontManager.bignoodle_90;
quickMatchButton = new TextButton("Quick Match", tbs1);
quickMatchButton.getLabelCell().padBottom(ASR.h(50));
quickMatchButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
Game.gsm.setState(Game.gsm.CONFIGUREMATCH);
}
});
quickMatchButton.addListener(new ClickListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button){
//This is not working!
quickMatchButton.getLabelCell().padBottom(ASR.h(100));
return true;
}
});
问题是(我认为)在将按钮添加到布局表后,我无法更改按钮内文本标签的位置。
所以主要问题:创建按钮后,如何更改按钮内 TextLabel 的位置(或填充)?
感谢您的宝贵时间!
【问题讨论】:
标签: android user-interface button libgdx