繁体   English   中英

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

[英]How to hide Android titlebar when Google Play Games is initialising?

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

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初始化时,有没有办法完全摆脱标题栏?

在你的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);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM