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.
Asked
Active
Viewed 1,866 times
1 Answers
10
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));

Tenfour04
- 83,111
- 11
- 94
- 154
-
thanks for the answer, btw can you look on my other question on stackoverflow, I can't fix the problem and your one of the best when it comes to libgdx, you've been answering my questions for years, thanks http://stackoverflow.com/questions/39774173/libgdx-game-crashes-on-android – Kevin Bryan Nov 08 '16 at 15:16