TODO ADD code here is for hiding status bar}
(note that this judgment is also triggered on screen switching, which requires filtering of the screen switching situation according to the actual situation.) )
-----------------------------------------------------------------------------------------------------
First, the Windowattributeschanged method is used to monitor the hiding and displaying of the status bar of the video playback page, by printing GetWindow (). GetAttributes (). Flags, get the page properties, so as to determine the status bar display and hide, can be monitored normally.
[Java] View plain copy @Override ublic void onwindowattributeschanged (Layoutparams params) {Super.onwindowattribute Schanged (params); LOG.E ("Even", "screen State" +getwindow (). GetAttributes (). Flags); if (GetWindow (). GetAttributes (). flags==8455424) {log.i ("TAG", "full screen state"); }else if (GetWindow (). GetAttributes (). flags==8454400) {log.i ("TAG", "not Full-screen State"); But soon found that other programs using this method of monitoring will only perform once, after all, feeling heterodoxy. So nearly twists and turns successfully using the Onsystemuivisibilitychangelistener interface to monitor.
[java] View plain copy @Override public void Onsystemuivisibilitychange (int visibility) { if (visibility==view.system_ui_flag_fullscreen| | Visibility==view.system_ui_flag_layout_fullscreen) {       LOG.I ("TAG", "full screen status = ="); }else{  LOG.I ("TAG", "not full screen status = = = = ="); } } prior to the addition of Setonsystemuivisibilitychangelistener (this); Give up this method several times and stagnate. I'm going to go.
systemuivisibility (int visibility) method can be passed in arguments:
View.system_ui_flag_visible: Display status bar, activity does not display full screen (revert to stateful normal condition).
View.invisible: Hides the status bar while the activity stretches full screen.
The View.SYSTEM_UI_FLAG_FULLSCREEN:Activity is full screen, and the status bar is hidden and overwritten.
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN:Activity full screen, but the status bar will not be hidden coverage, the status bar is still visible, activity, the top layout will be covered by the state.
View.system_ui_flag_layout_hide_navigation: Effect with View.system_ui_flag_layout_fullscreen
View.system_ui_layout_flags: Effect with View.system_ui_flag_layout_fullscreen
View.system_ui_flag_hide_navigation: Hides the virtual keys (navigation bar). Some phones use virtual buttons instead of physical buttons.
View.system_ui_flag_low_profile: Status bar display is in low energy display (lower profile mode), some icons on the status bar appear hidden.
Write here to simply set the status bar to hide and display the method also sorted:
The view class provides setsystemuivisibility and Getsystemuivisibility methods that implement dynamic display or hidden actions on the status bar and get the current visibility of the status bar.
The setsystemuivisibility (int visibility) method of the view is validated with a demo to implement the dynamic Operation status bar:
1, Maiactivity.java:
[Java] View plain copy package Com.example.handlestatusbar; Import Android.annotation.SuppressLint; Import android.app.Activity; Import Android.os.Bundle; Import Android.view.Menu; Import Android.view.MenuItem; Import Android.view.View; Import Android.view.View.OnClickListener; Import Android.widget.Button; Import Android.widget.RelativeLayout;