I'm making a game using libgdx which has a lot of buttons and text fields, I was wondering if there was a Scene2d widget which the user can hover and then a message shows up, something like this.
These are called Tooltips. There is a built-in one called TextTooltip. If you're using skin, you can create a style like this in Json:
com.badlogic.gdx.scenes.scene2d.ui.TextTooltip$TextTooltipStyle: {
default: {label: {font: myFont}, background: myBackgroundDrawable, wrapWidth: 400}
}
Tooltips actually are a type of Listener that contain a widget that it temporarily can add to the Stage. You add the tooltip to whatever widget you already have in your layout:
myButton.addListener(new TextTooltip("You can press this", skin));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With