OnApplyWindowInsetsListener

Added in 1.1.0

public interface OnApplyWindowInsetsListener

Known direct subclasses
WindowInsetsApplier

An OnApplyWindowInsetsListener that applies WindowInsets to all children of a ViewPager2, making sure they all receive the same insets regardless of whether any of them consumed any insets.


Listener for applying window insets on a view in a custom way.

Apps may choose to implement this interface if they want to apply custom policy to the way that window insets are treated for a view. If an OnApplyWindowInsetsListener is set, its onApplyWindowInsets method will be called instead of the View's own onApplyWindowInsets method. The listener may optionally call the parameter View's onApplyWindowInsets method to apply the View's normal behavior as part of its own.

Summary

Public methods

abstract @NonNull WindowInsetsCompat

When set on a View, this listener method will be called instead of the view's own onApplyWindowInsets method.

Public methods

onApplyWindowInsets

Added in 1.1.0
abstract @NonNull WindowInsetsCompat onApplyWindowInsets(@NonNull View v, @NonNull WindowInsetsCompat insets)

When set on a View, this listener method will be called instead of the view's own onApplyWindowInsets method.

Parameters
@NonNull View v

The view applying window insets

@NonNull WindowInsetsCompat insets

The insets to apply

Returns
@NonNull WindowInsetsCompat

The insets supplied, minus any insets that were consumed