1

i am using this method to hide status bar :

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

this works fine but when i start video i have notice the status bar is visible again , after some test on my code i have realized that the status bar i visible after i add the MediaController .

how can i keep my full screen and still using MediaController ?

this is how i add the MediaController

   mMediaController = new MediaController(getContext());
   mMediaController.setAnchorView(this);
   setMediaController(mMediaController);
Jesus Dimrix
  • 4,378
  • 4
  • 28
  • 62

2 Answers2

0

use:

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

or

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

and see this link: http://developer.android.com/training/system-ui/status.html
and this link: How to hide status bar in Android

Community
  • 1
  • 1
yasser karimi
  • 329
  • 3
  • 13
0

Yes, the videoView can bring back the status bar. Not sure what the behind principle is. While you can resolve it by setting a setOnSystemUiVisibilityChangeListener, Something like:

        getWindow().getDecorView().setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
        @Override
        public void onSystemUiVisibilityChange(int visibility) {
            getWindow().getDecorView().setSystemUiVisibility(
                    View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            );
        }
    });
Freddie
  • 210
  • 3
  • 6