Unable to remove Navigation Bar - Android Tablet: 4.2.2

淺唱寂寞╮ 提交于 2020-01-03 05:15:22

问题


I'm attempting to remove the navigation bar programatically using the most commonly found method on the internet - however the navigation bar continues to appear.

I've debugged the method and it is not throwing an exception - so I'm really not sure why we can't seem to hide the Navigation Bar using the following code:

(any suggestions are greatly appreciated)

Source:

try
{
Process proc = Runtime.getRuntime().exec(new String[]{"su","-c","service call activity 42 s16 com.android.systemui"}); 
proc.waitFor();
}
catch(Exception ex)
{
//Toast.makeText(getApplicationContext

回答1:


Try doing this, somewhere after you have set your content's view

To hide your navigation bar

View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);

To hide your keyboard

InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0);

For more on the navigation bar, since it is what your question explicitly asks for, take a look here: Hiding the Navigation Bar



来源:https://stackoverflow.com/questions/23435857/unable-to-remove-navigation-bar-android-tablet-4-2-2

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