如何在 LibGDX 上显示状态栏? 我尝试过这段代码:
config.hideStatusBar = false;
还有这个:
<resources>
<style name="GdxTheme" parent="android:Theme">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowAnimationStyle">@android:style/Animation</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowFullscreen">false</item>
</style>
但是,这不行。 请帮助我
最佳答案
config.hideStatusBar = false;
//默认情况下该值为 false
在您的 AndroidLauncher
类中尝试此代码。
RelativeLayout layout = new RelativeLayout(this);
layout.addView(initializeForView(new Splash(), config));
setContentView(layout);
当您调用 initializeForView
而不是 initialize
时,下面的语句不会执行。
try {
requestWindowFeature(Window.FEATURE_NO_TITLE);
} catch (Exception ex) {
log("AndroidApplication", "Content already displayed, cannot request FEATURE_NO_TITLE", ex);
}
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
setContentView(graphics.getView(), createLayoutParams());
还有一件事,当您单击 AndoridManifest.xml
文件中的 GdxTheme
时,它会显示多个实现,其中一个位于此 中android/res/values/styles.xml
另一个是
/Users/User_name/.android/build-cache/ea795811fd85c01c9ffd4c12717047945b0f2585/output/res/values-v11/values-v11.xml
当我编辑 android/res/values/styles.xml
文件时,没有任何反应。
<resources>
<style name="GdxTheme" parent="android:Theme">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowAnimationStyle">@android:style/Animation</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowFullscreen">false</item>
</style>
</resources>
然后我做同样的改变
/Users/User_name/.android/build-cache/ea795811fd85c01c9ffd4c12717047945b0f2585/output/res/values-v11/values-v11.xml
之后就可以了。
我尝试清理 buildCache
./gradlew cleanBuildCache
也清理项目,但更改不会从我的项目反射(reflect)到缓存 .xml
文件。
关于java - 如何在 LibGDX 上显示状态栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43427978/