一、android
修改frameworks\runtime-src\proj.android\src\org\cocos2dx\lua\AppActivity.java,在onCreate中添加,即可在android平台显示沉浸式状态栏
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN|WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
AndroidManifest.xml中activity的android:theme修改如下
改前:android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
改后:android:theme="@android:style/Theme.NoTitleBar"
二、IOS
1.修改Info.plist
添加View controller-based status bar appearance并赋值为NO
添加Status bar is initially hidden并赋值为NO
2.修改AppController.mm
修改didFinishLaunchingWithOptions函数下的setStatusBarHidden为NO
[[UIApplication sharedApplication] setStatusBarHidden: NO];
3.修改RootViewController.mm下对应内容
- (BOOL)prefersStatusBarHidden
{
return NO; //修改为NO, 2dx模板为YES
}
网友评论