2016-01-25 62 views
1

媒體控制器我使用這種方法來隱藏狀態欄:隱藏狀態欄,同時對Android的

public static void hideStatusBar(Activity activity) { 
    if (Build.VERSION.SDK_INT < 16) { 
     activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 
    } else { 
     View decorView = activity.getWindow().getDecorView(); 
     int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN; 
     decorView.setSystemUiVisibility(uiOptions); 
    } 
} 

這工作得很好,但是當我開始視頻我已經注意到狀態欄再次可見,一些測試後在我的代碼,我已經意識到,在狀態欄看到我後,我添加的MediaController。

如何我把我的全屏幕,仍然使用的MediaController?

這是我怎麼添加的MediaController

mMediaController = new MediaController(getContext()); 
    mMediaController.setAnchorView(this); 
    setMediaController(mMediaController); 

回答

0

使用:

<application 
... 
android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen" > 
... 
</application> 

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(); 

,看看這個鏈接: http://developer.android.com/training/system-ui/status.html
與此鏈接: How to hide status bar in Android

+0

爲我寫的,我可以隱藏狀態欄你的建議,但會的MediaController讓他回來...... –