当我初始化google play games时,当我的游戏加载完毕,并且“连接到google play games”窗口出现在开始处,android标题栏也会立即出现。一旦gpg登录窗口消失,它就会消失。我该如何阻止这种情况发生?在我的游戏清单中,活动标签中设置了以下样式:
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
很明显,这是有效的,因为当我的游戏运行时,我看不到工具栏。我看了一下google play game services gamebaseutils清单,它没有任何活动标记,所以我向应用程序标记添加了notitlebar样式,如下所示:
<application
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
</application>
但是,当游戏加载并初始化google play games时,标题栏仍会显示(暂时)。当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);