据我所知,在LibGDX
中,ImageButton
是包含图像的框架。是否可以设置框架的背景?
例如,我想使用按钮背景,并在该图像顶部应用图标。
当前代码
带有背景的皮肤:
"com.badlogic.gdx.scenes.scene2d.ui.ImageButton$ImageButtonStyle": {
"default": {
"imageDown": "button-down",
"imageUp": "button-up"
}
}
创建ImageButton:
// Getting imageButtonStyle with "default" style, as it just has the background.
ImageButton.ImageButtonStyle imageButtonStyle = skin.get( "default", ImageButton.ImageButtonStyle.class );
ImageButton button = new ImageButton( imageButtonStyle );
// Set the image on the button to something.
背景图片。
带有叠加图标的背景图片。
感谢您的帮助。