Interface ViewOutlineProvider

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ViewOutlineProvider
Interface by which a View builds its Outline, used for shadow casting and clipping.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final ViewOutlineProvider
    Default outline provider for Views, which queries the Outline from the View's background, or generates a 0 alpha, rectangular Outline the size of the View if a background isn't present.
    static final ViewOutlineProvider
    Maintains the outline of the View to match its rectangular bounds, at 1.0f alpha.
    static final ViewOutlineProvider
    Maintains the outline of the View to match its rectangular padded bounds, at 1.0f alpha.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    getOutline(View view, Outline outline)
    Called to get the provider to populate the Outline.
  • Field Details

    • BACKGROUND

      static final ViewOutlineProvider BACKGROUND
      Default outline provider for Views, which queries the Outline from the View's background, or generates a 0 alpha, rectangular Outline the size of the View if a background isn't present.
      See Also:
    • BOUNDS

      static final ViewOutlineProvider BOUNDS
      Maintains the outline of the View to match its rectangular bounds, at 1.0f alpha.

      This can be used to enable Views that are opaque but lacking a background cast a shadow.

    • PADDED_BOUNDS

      static final ViewOutlineProvider PADDED_BOUNDS
      Maintains the outline of the View to match its rectangular padded bounds, at 1.0f alpha.

      This can be used to enable Views that are opaque but lacking a background cast a shadow.

  • Method Details

    • getOutline

      void getOutline(@NonNull View view, @NonNull Outline outline)
      Called to get the provider to populate the Outline.

      This method will be called by a View when its owned Drawables are invalidated, when the View's size changes, or if View.invalidateOutline() is called explicitly.

      The input outline is empty and has an alpha of 1.0f.

      Parameters:
      view - The view building the outline.
      outline - The empty outline to be populated.