How To Get Notify When System UI Visibility Changes In Android?

When ever you hide system bars to give fullscreen experience you should also hide or show other part of you app's UI as per your requirements. i.e. play , pause buttons , game controls etc.
In this post we gonna learn how to listen for system bars hide / show event and make any desired changes accordingly.

To listen for system bars hide / show event,register View.OnSystemUiVisibilityChangeListener() to view.This could be any view you used for controlling navigation visibility.

In Following Code Snipped We Have Registered Listener in Activity's onCreate() method.


It's best precise to sync you UI with system bar visibility changes.You could use this code to hide and show video player controls in sync with status bar hide and show event.

No comments:

Post a Comment