# AndroidWindowInsets

> Provides control over the windows that generate insets.

## Definition

* **Type:** Class
* **Namespace:** [UnityEngine.Android](/engine/6000.7/script-reference/unityengine/android.md)
* **Assembly:** UnityEngine.AndroidJNIModule

```csharp
public class AndroidWindowInsets
```

## Remarks

These windows represent the system UI elements for system bars, such as the status and navigation bars. Use this class to determine the current state of the system bars, control their visibility and behavior at runtime, allowing your application to make full use of the device screen space.

Additional Resources: [About window insets (Android)](https://developer.android.com/develop/ui/compose/system/insets)

## Examples

```csharp
using UnityEngine;
using UnityEngine.Android;

public class AndroidInsets : MonoBehaviour
{
    public string GetInsetsVisibility(AndroidWindowInsets.Type type)
    {
        if (AndroidApplication.currentWindowInsets == null)
            return "Unknown";
        return AndroidApplication.currentWindowInsets.IsVisible(type) ? "Visible" : "Hidden";
    }

    public void OnGUI()
    {
        var options = new[] { GUILayout.Height(100), GUILayout.ExpandWidth(true) };
        GUILayout.Space(100);
        GUILayout.Label($"Status Bars: {GetInsetsVisibility(AndroidWindowInsets.Type.StatusBars)}", options);
        GUILayout.Label($"Navigation Bars: {GetInsetsVisibility(AndroidWindowInsets.Type.NavigationBars)}", options);

        var insets = AndroidApplication.currentWindowInsets;
        GUILayout.BeginHorizontal(GUILayout.Width(Screen.width));
        if (GUILayout.Button("Show Status Bars", options))
            insets.Show(AndroidWindowInsets.Type.StatusBars);
        if (GUILayout.Button("Hide Status Bars", options))
            insets.Hide(AndroidWindowInsets.Type.StatusBars);
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal(GUILayout.Width(Screen.width));
        if (GUILayout.Button("Show Navigation Bars", options))
            insets.Show(AndroidWindowInsets.Type.NavigationBars);
        if (GUILayout.Button("Hide Navigation Bars", options))
            insets.Hide(AndroidWindowInsets.Type.NavigationBars);
        GUILayout.EndHorizontal();

        GUILayout.Label($"System Bars Behavior: {insets.GetSystemBarsBehavior()}", options);
        GUILayout.BeginHorizontal(GUILayout.Width(Screen.width));
        if (GUILayout.Button("Default", options))
            insets.SetSystemBarsBehavior(AndroidWindowInsets.SystemBarsBehavior.Default);
        if (GUILayout.Button("ShowTransientBarsBySwipe", options))
            insets.SetSystemBarsBehavior(AndroidWindowInsets.SystemBarsBehavior.ShowTransientBarsBySwipe);
        GUILayout.EndHorizontal();
    }
}
```

## Methods

| Method                                                                                                                        | Description                                                                                                                                                    |
| ----------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [GetAppearance](/engine/6000.7/script-reference/unityengine/android/androidwindowinsets/getappearance.md)                     | Returns the current foreground appearance of the specified inset type.                                                                                         |
| [GetBounds](/engine/6000.7/script-reference/unityengine/android/androidwindowinsets/getbounds.md)                             | Returns the screen-space rectangle where an overlapping inset covers the application window.                                                                   |
| [GetOverlapping](/engine/6000.7/script-reference/unityengine/android/androidwindowinsets/getoverlapping.md)                   | Returns which insets are currently configured to overlap with the application window.                                                                          |
| [GetSystemBarsBackground](/engine/6000.7/script-reference/unityengine/android/androidwindowinsets/getsystembarsbackground.md) | Returns the current system bars background setting.                                                                                                            |
| [GetSystemBarsBehavior](/engine/6000.7/script-reference/unityengine/android/androidwindowinsets/getsystembarsbehavior.md)     | Retrieves the configured behavior of system bars, such as status and navigation bars.                                                                          |
| [Hide](/engine/6000.7/script-reference/unityengine/android/androidwindowinsets/hide.md)                                       | Hides a set of windows that generate insets.                                                                                                                   |
| [IsVisible](/engine/6000.7/script-reference/unityengine/android/androidwindowinsets/isvisible.md)                             | Indicates whether a set of windows that might generate insets is currently visible on screen, regardless of whether they overlap with your application window. |
| [SetAppearance](/engine/6000.7/script-reference/unityengine/android/androidwindowinsets/setappearance.md)                     | Sets the foreground appearance of the specified inset types at runtime.                                                                                        |
| [SetOverlapping](/engine/6000.7/script-reference/unityengine/android/androidwindowinsets/setoverlapping.md)                   | Sets which insets are allowed to overlap with the application window.                                                                                          |
| [SetSystemBarsBackground](/engine/6000.7/script-reference/unityengine/android/androidwindowinsets/setsystembarsbackground.md) | Sets the system bars background to opaque or transparent.                                                                                                      |
| [SetSystemBarsBehavior](/engine/6000.7/script-reference/unityengine/android/androidwindowinsets/setsystembarsbehavior.md)     | Controls the behavior of system bars.                                                                                                                          |
| [Show](/engine/6000.7/script-reference/unityengine/android/androidwindowinsets/show.md)                                       | Displays a set of windows that generate insets on screen.                                                                                                      |

## Enums

| Enum                                                                                                                                        | Description                                                                                  |
| ------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| [AndroidWindowInsets.Appearance](/engine/6000.7/script-reference/unityengine/android/androidwindowinsets/appearance.md)                     | Controls the foreground appearance of system bar icons and text.                             |
| [AndroidWindowInsets.SystemBarsBackground](/engine/6000.7/script-reference/unityengine/android/androidwindowinsets/systembarsbackground.md) | Controls whether system bars have an opaque or transparent background.                       |
| [AndroidWindowInsets.SystemBarsBehavior](/engine/6000.7/script-reference/unityengine/android/androidwindowinsets/systembarsbehavior.md)     | Options for controlling the behavior of system bars, such as the status and navigation bars. |
| [AndroidWindowInsets.Type](/engine/6000.7/script-reference/unityengine/android/androidwindowinsets/type.md)                                 | Options for specifying different types of system UI elements that generate window insets.    |
