Hello I want to combine between android UI and libGDX. I want to have half of my screen with libgdx engine (animated sprite) and the other half of the screen with android UI buttons. Does anybody know how to do it?
Libgdx has a great UI package called scene2d. It is specially written for UIs, but can be used for other things also.
What you will want to do is create a UI stage. During your game loop call stage.draw() after you draw your game so it renders over the top of your game. If you just want to use the UI to receive input then just use
You add widgets (widgets being things like tables, buttons, and more) to the stage. And then add change listeners to the particular widgets to help control your game.
Nothing special, it just works. Libgdx view is just a wrapper around an ordinary OpenGL view, you can use it with any layout (including a LinearLayout split in half).
The autogenerated code has an
If you remove the call, you can instead use