Google Play游戏初始化时如何隐藏Android标题栏?

时间:2018-08-19 18:30:22

标签: android libgdx google-play-games

当我初始化Google Play游戏时,加载游戏后,“连接到Google Play游戏”窗口开始出现-Android标题栏也会短暂出现。一旦GPG登录窗口消失,它就会消失。我如何阻止这种情况发生?在游戏清单中,我在活动标记中设置了以下样式:

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

这显然很有效,因为在我的游戏运行时我看不到工具栏。我看了看Google Play游戏服务GameBaseUtils清单,它没有任何活动标签,因此我将NoTitleBar样式添加到了应用程序标签中,如下所示:

<application
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
    <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
</application>

但是,在加载游戏和初始化Google Play游戏时,标题栏仍会(立即)显示。 GPG初始化时,有什么方法可以完全摆脱标题栏?

1 个答案:

答案 0 :(得分:0)

在您的onCreate()方法中执行此操作。 干杯!

//Remove title bar

this.requestWindowFeature(Window.FEATURE_NO_TITLE);

//Remove notification bar
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

//set content view AFTER ABOVE sequence (to avoid crash)
this.setContentView(R.layout.your_layout_name_here);