Android 4.0: setting SYSTEM_UI_FLAG_LOW_PROFILE & SYSTEM_UI_FLAG_HIDE_NAVIGATION from Activity instead of View

女生的网名这么多〃 提交于 2019-12-06 09:43:40

This is what I put in onCreate of my activities:

View main_layout = dialog.findViewById(android.R.id.content).getRootView();
main_layout.setSystemUiVisibility(View.STATUS_BAR_HIDDEN);

It's almost like calling it from an activity context. At least it's not dependent on having a view defined at compile time. I know STATUS_BAR_HIDDEN is deprecated, but I can't get SYSTEM_UI_FLAG_LOW_PROFILE to compile at the moment...

But +1 on the "this seems like a strange place for these settings". Should be something you can define in the manifest once for the entire app.

You can't completely remove the ICS navigation buttons.

You can hide them completely, but they'll reappear as soon as you touch the screen:

getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);

Unfortunately, some ICS UI layers like Samsung's TouchWiz won't recognize SYSTEM_UI_FLAG_HIDE_NAVIGATION.

Alternatively, you can minimize them and they'll only appear when the bar it tapped:

getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);

You'll probably have to build your own ROM to eliminate them completely.

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