- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个项目需要如下所示:
使用窗口我得到以下结果
我使用以下代码创建上述结果
private Table buildControlsWindowLayer() {
Window window = new Window("", skinLibgdx);
// + play button
playButton = new Button(maputoSkin, "play");
window.add(playButton).pad(10, 0, 10, 0).row();
playButton.addListener(listener);
// + options button
optionsButton = new Button(maputoSkin, "options");
window.add(optionsButton).pad(10, 0, 10, 0).row();
optionsButton.addListener(listener);
// + leaders button
leadersButton = new Button(maputoSkin, "leaders");
window.add(leadersButton).pad(10, 0, 10, 0).row();
leadersButton.addListener(listener);
if (Constants.DEBUG_FLAG_MENU_SCREEN) window.debug();
window.pack();
window.setPosition(Constants.VIEWPORT_GUI_WIDTH / 2 - window.getWidth()/2,
Constants.VIEWPORT_GUI_HEIGHT/2 - window.getHeight());
return window;
}
我的问题
我。如何去掉标题栏
二.如何设置自己的背景而不是 libgdx 默认背景
三.对于第三种情况,这种方法是否正确?
最佳答案
com.badlogic.gdx.scenes.scene2d.ui.Window 带有一个构造函数: Window(java.lang.String title, Window.WindowStyle style)
还有一个 setStyle(Window.WindowStyle style) 方法。 Window.WindowStyle
类允许您定义此窗口的样式,包括背景。 (https://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/scenes/scene2d/ui/Window.WindowStyle.html)
根据 libgdxs 文档,标题栏是一个窗口:
“一个可以拖动并充当模态窗口的表格。顶部填充用作窗口的标题高度。”,我没有找到任何直接的方法来摆脱标题栏,但是如果你扩展窗口类,您可以覆盖其中的一些功能以获得所需的结果。查看其来源:https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/scenes/scene2d/ui/Window.java
要回答第三个问题,您必须提供更多信息,在这种情况下您的意思是什么?
关于java - 如何在libgdx中创建没有标题栏的窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45426566/
我是一名优秀的程序员,十分优秀!