Compartilhar via


View.OnApplyWindowInsets(WindowInsets) Method

Definition

Called when the view should apply WindowInsets according to its internal policy.

[Android.Runtime.Register("onApplyWindowInsets", "(Landroid/view/WindowInsets;)Landroid/view/WindowInsets;", "GetOnApplyWindowInsets_Landroid_view_WindowInsets_Handler")]
public virtual Android.Views.WindowInsets? OnApplyWindowInsets (Android.Views.WindowInsets? insets);
[<Android.Runtime.Register("onApplyWindowInsets", "(Landroid/view/WindowInsets;)Landroid/view/WindowInsets;", "GetOnApplyWindowInsets_Landroid_view_WindowInsets_Handler")>]
abstract member OnApplyWindowInsets : Android.Views.WindowInsets -> Android.Views.WindowInsets
override this.OnApplyWindowInsets : Android.Views.WindowInsets -> Android.Views.WindowInsets

Parameters

insets
WindowInsets

Insets to apply

Returns

The supplied insets with any applied insets consumed

Attributes

Remarks

Called when the view should apply WindowInsets according to its internal policy.

This method should be overridden by views that wish to apply a policy different from or in addition to the default behavior. Clients that wish to force a view subtree to apply insets should call #dispatchApplyWindowInsets(WindowInsets).

Clients may supply an OnApplyWindowInsetsListener to a view. If one is set it will be called during dispatch instead of this method. The listener may optionally call this method from its own implementation if it wishes to apply the view's default insets policy in addition to its own.

Implementations of this method should either return the insets parameter unchanged or a new WindowInsets cloned from the supplied insets with any insets consumed that this view applied itself. This allows new inset types added in future platform versions to pass through existing implementations unchanged without being erroneously consumed.

By default if a view's #setFitsSystemWindows(boolean) fitsSystemWindows property is set then the view will consume the system window insets and apply them as padding for the view.

Java documentation for android.view.View.onApplyWindowInsets(android.view.WindowInsets).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to