2014-02-09 68 views
0

我有下面的代碼隱藏http://developer.android.com/training/system-ui/status.html採取的狀態欄和Hide status bar androidAndroid的隱藏狀態欄,兼容性

//hide statut bar 
    if (Build.VERSION.SDK_INT < 16) { //ye olde method 
     getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
         WindowManager.LayoutParams.FLAG_FULLSCREEN); 
    } else { // Jellybean and up, new hotness 
     View decorView = getWindow().getDecorView(); 
     // Hide the status bar. 
     int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN; 
     decorView.setSystemUiVisibility(uiOptions); 
     // Remember that you should never show the action bar if the 
     // status bar is hidden, so hide that too if necessary. 
     ActionBar actionBar = getActionBar(); 
     actionBar.hide(); 
    } 

我得到View.SYSTEM_UI_FLAG_FULLSCREEN的錯誤;

看來SYSTEM_UI_FLAG_FULLSCREEN在View中不再存在。

如何解決?請謝謝

回答

1

自API16以來就存在。你必須建立你的應用程序對API16(或更高)

+0

好吧,我不知道這個謝謝 – LeSam