我正在使用此代码隐藏导航栏。它在旧版本的android上运行良好,但在KitKat上无效。
public void KillStatusBar() {
Process proc = null;
String ProcID = "79"; // HONEYCOMB AND OLDER
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
ProcID = "42"; // ICS AND NEWER
}
if(Build.VERSION.SDK_INT>Build.VERSION_CODES.JELLY_BEAN_MR2){
return;
}
答案 0 :(得分:1)
你真的“杀”了吗?您应该遵循指南:
http://developer.android.com/training/system-ui/status.html
Android 4.0及更低版本:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
4.1及更高版本:
View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);