问题
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