Libgdx-MD-Toggle is a scene2dUI implemetation of a Google material design style Toggle control. It is a simple extension of the Libgdx Slider with the addition of changing the knob and background as the toggle is switched, as well as providing a property to indicate whether it is on or not.
##GettingStarted ##Prerequisites This is designed to be used with Libgdx
###Usage
-
Copy Toggle.java somewhere in you application
-
Create a ToggleStyle in your skin. (uiskin.json and matching requirements in uiskin.atlas and uiskin.png if you're using them, see example for uiskin.json))
*You will need to include drawables for background, knobBefore, knobAfter, knob and knobOn. Some .svg files have been included to make creating each of them easier.
*Ensure the package name matches that of where you put the Toggle class.
-
Create a new Toggle like any other UI widget:
Toggle toggle = new Toggle(false, skin);