【发布时间】:2013-06-27 03:46:43
【问题描述】:
当我的某些事件被触发时,我需要能够更改 Libgdx Button 的外观。
这是我的按钮的声明:
Button googleButton = new Button(skin.getDrawable("google_sign_in"));
这是我尝试过的事情:
googleButton.setBackground(skin.getDrawable("google_sign_out"));
googleButton.invalidate();
googleButton.setChecked(true);
googleButton.invalidate();
googleButton.getStyle().up = skin.getDrawable("google_sign_out");
googleButton.invalidate();
我进行了很多搜索,但找不到答案。有人可以告诉我这样做的正确方法吗?
【问题讨论】:
-
问题是我不希望它在上下事件时改变它的外观,它是没有与按钮本身链接的事件需要切换其图像。跨度>
-
我需要能够更改图片,而不是相同。也许我不需要使用按钮,我应该使用什么类型的演员才能动态更改其图像?
-
您也可以发布“google_sign_in”样式吗?
-
这不是一种样式,它是一个可绘制对象。
标签: java android button drawable libgdx