Remove system menu bar from react native android app

旧时模样 提交于 2019-12-24 12:44:12

问题


My problem is simple and I have been unable to find a solution. The menu bar is very annoying in my app and I am hoping that there is a way to remove it.


回答1:


Looking at Hiding the Navigation Bar I found this:

You can hide the navigation bar on Android 4.0 and higher using the SYSTEM_UI_FLAG_HIDE_NAVIGATION flag. This snippet hides both the navigation bar and the status bar:

View decorView = getWindow().getDecorView();
// Hide both the navigation bar and the status bar.
// SYSTEM_UI_FLAG_FULLSCREEN is only available on Android 4.1 and higher, but as
// a general rule, you should design your app to hide the status bar whenever you
// hide the navigation bar.
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
          | View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);

I do not know if that's exactly what you was looking for, but you can test it.




回答2:


I suggest you read more about native modules, it enables you to write native code and access it from JS.

http://facebook.github.io/react-native/docs/native-modules-android.html#content

Also the StatusBar module is very similar to what you want to do here, you can have a look at the source.

https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.java#L110



来源:https://stackoverflow.com/questions/35977845/remove-system-menu-bar-from-react-native-android-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!