Package 

Class WindowInsetsControllerCompat


  • 
    public final class WindowInsetsControllerCompat
    
                        

    Provide simple controls of windows that generate insets. For SDKs >= 30, this class is a simple wrapper around WindowInsetsController. For lower SDKs, this class aims to behave as close as possible to the original implementation.

    • Constructor Detail

      • WindowInsetsControllerCompat

        WindowInsetsControllerCompat(Window window, View view)
    • Method Detail

      • show

         void show(int types)

        Makes a set of windows that cause insets appear on screen.

        Note that if the window currently doesn't have control over a certain type, it will apply thechange as soon as the window gains control. The app can listen to the event by observing onApplyWindowInsets and checking visibility with isVisible.

        Parameters:
        types - A bitmask of WindowInsetsCompat.Type specifying what windows the appwould like to make appear on screen.
      • hide

         void hide(int types)

        Makes a set of windows causing insets disappear.

        Note that if the window currently doesn't have control over a certain type, it will apply thechange as soon as the window gains control. The app can listen to the event by observing onApplyWindowInsets and checking visibility with isVisible.

        Parameters:
        types - A bitmask of WindowInsetsCompat.Type specifying what windows the appwould like to make disappear.
      • isAppearanceLightStatusBars

         boolean isAppearanceLightStatusBars()

        Checks if the foreground of the status bar is set to light.

        This method always returns false on API < 23.

      • setAppearanceLightStatusBars

         void setAppearanceLightStatusBars(boolean isLight)

        If true, changes the foreground color of the status bars to light so that the items on thebar can be read clearly. If false, reverts to the default appearance.

        This method has no effect on API < 23.

      • isAppearanceLightNavigationBars

         boolean isAppearanceLightNavigationBars()

        Checks if the foreground of the navigation bar is set to light.

        This method always returns false on API < 26.

      • setAppearanceLightNavigationBars

         void setAppearanceLightNavigationBars(boolean isLight)

        If true, changes the foreground color of the navigation bars to light so that the items onthe bar can be read clearly. If false, reverts to the default appearance.

        This method has no effect on API < 26.

      • setSystemBarsBehavior

         void setSystemBarsBehavior(int behavior)

        Controls the behavior of system bars.

        Parameters:
        behavior - Determines how the bars behave when being hidden by the application.