Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6183515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:22:44+00:00 2026-05-24T01:22:44+00:00

Android and libgdx noob here. Does anyone know anything about the recent UI API

  • 0

Android and libgdx noob here.

Does anyone know anything about the recent UI API that was released for libgdx?
See blog post here: http://www.badlogicgames.com/wordpress/?p=2058

I am looking to create a basic menu system, and I was wondering if this UI API would make it easier.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T01:22:45+00:00Added an answer on May 24, 2026 at 1:22 am

    Updated to reflect changes to the LibGDX

    I am in a similar position, the following code worked for me to create a basic menu (A container of buttons). The code won’t work as is, because it uses some of my classes, but what really matter is the content of the create method. This creates a centered title, then some buttons in a container that gets centered, then fps label in the lower left and an image in the lower right corner. The theme files and some of the images are from the LibGDX tests assets.

    I’ve gotten this to work with the JOGL, LWJGL, and android application classes. I’ve run it on a Droid 2 and got it to run as it did on my desktop. Hopefully this should get you started.

    public class MenuScreen extends Screen{
    private Stage ui;
    private Table window;
    @Override
    public void create(final Game game) {
        super.create(game);
        TextureRegion image = new TextureRegion(new Texture(Gdx.files.internal(Art.badlogicSmall)));
        Label fps = new Label("fps: ", Art.sSkin.getStyle(LabelStyle.class),"fps");
        ui = new Stage(Gdx.graphics.getWidth(),Gdx.graphics.getHeight(), true);
        Gdx.input.setInputProcessor(ui);
        window = new Table("window");
        window.width = ui.width();
        window.height = ui.height();
        window.x = 0;
        window.y = 0;
        window.debug();
        Label title = new Label("Title",Art.sSkin.getStyle(LabelStyle.class),"title");
        Button newGame = new Button("New Game",Art.sSkin.getStyle(ButtonStyle.class),"new");
        newGame.setClickListener(new ClickListener() {
            @Override
            public void click(Actor actor) {
                game.setScreen(GameScreen.class);               
            }
        });
        Button optionMenu = new Button("Option",Art.sSkin.getStyle(ButtonStyle.class),"Options");
        Button helpMenu = new Button("Help",Art.sSkin.getStyle(ButtonStyle.class),"Help");
        Image libgdx = new Image("libgdx", image);
        window.row().fill(false,false).expand(true,false).padTop(50).padBottom(50);
        window.add(title);
        Table container = new Table("menu");
        container.row().fill(true, true).expand(true, true).pad(10, 0, 10, 0);
        container.add(newGame);
        container.row().fill(true, true).expand(true, true).pad(10, 0, 10, 0);
        container.add(optionMenu);
        container.row().fill(true, true).expand(true, true).pad(10, 0, 10, 0);
        container.add(helpMenu);
        window.row().fill(0.5f,1f).expand(true,false);
        window.add(container);
        Table extras = new Table("extras");
        extras.row().fill(false,false).expand(true,true);
        extras.add(fps).left().center().pad(0,25,25,0); 
        extras.add(libgdx).right().center().pad(0,0,25,25);
        window.row().fill(true,false).expand(true,true);
        window.add(extras).bottom();
        ui.addActor(window);
    }
    
    @Override
    public void render(float arg0) {
        Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1);
        Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
        ((Label)ui.findActor("fps")).setText("fps: " + Gdx.graphics.getFramesPerSecond());  
        ui.act(Math.min(Gdx.graphics.getDeltaTime(), 1 / 30f));
        ui.draw();
        Table.drawDebug(ui);
    }
    @Override
    public void resize(int width, int height) {
        ui.setViewport(width, height, true);
        Log.d("Resize: "+width+", "+height);
    }
    

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On Android devices, does anyone has checked that if a user clicks on a
I'm writing a game for Android using libgdx. Here is some code that draws
ANDROID: Wanted to know whether is there any API or workaround to know that
How do you write native (C/C++) code with Libgdx that works for Android and
Android comes with lots of system resources ( android.R ) that can be used
When android unbind a service I created (service.MyService), I see the following DeadObjectException. Can
Can Android OS that is installed on actual devices be emulated in VMWare or
My Android application uses Java OAuth library, found here for authorization on Twitter. I
Android - What is the maximum file size that setMaxFileSize can be set to
Android got XML layout design with a tool that allow you to drop and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.