Stay organized with collections
Save and categorize content based on your preferences.
ViewOutlineProvider
abstract class ViewOutlineProvider
Interface by which a View builds its Outline
, used for shadow casting and clipping.
Summary
Public methods |
abstract Unit |
Called to get the provider to populate the Outline.
|
Properties |
static 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 ViewOutlineProvider! |
Maintains the outline of the View to match its rectangular bounds, at 1.0f alpha.
|
static ViewOutlineProvider! |
Maintains the outline of the View to match its rectangular padded bounds, at 1.0f alpha.
|
Public constructors
ViewOutlineProvider
ViewOutlineProvider()
Public methods
getOutline
abstract fun getOutline(
view: View!,
outline: Outline!
): Unit
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 |
View!: The view building the outline. |
outline |
Outline!: The empty outline to be populated. |
Properties
BACKGROUND
static val BACKGROUND: 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.
BOUNDS
static val BOUNDS: ViewOutlineProvider!
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 val PADDED_BOUNDS: ViewOutlineProvider!
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.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# ViewOutlineProvider\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nViewOutlineProvider\n===================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/view/ViewOutlineProvider \"View this page in Java\") \n\n```\nabstract class ViewOutlineProvider\n```\n\n|---|---------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.view.ViewOutlineProvider](#) |\n\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [RemoteViews.RemoteViewOutlineProvider](../widget/RemoteViews.RemoteViewOutlineProvider.html#) |------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [RemoteViews.RemoteViewOutlineProvider](../widget/RemoteViews.RemoteViewOutlineProvider.html#) | OutlineProvider for a view with a radius set by [setViewOutlinePreferredRadius(int,float,int)](../widget/RemoteViews.html#setViewOutlinePreferredRadius(kotlin.Int,%20kotlin.Float,%20kotlin.Int)). | |\n\nInterface by which a View builds its [Outline](../graphics/Outline.html#), used for shadow casting and clipping.\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------------------------------|---|\n| [ViewOutlineProvider](#ViewOutlineProvider())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [getOutline](#getOutline(android.view.View,%20android.graphics.Outline))`(`view:` `[View](/reference/kotlin/android/view/View)!`, `outline:` `[Outline](../graphics/Outline.html#)!`)` Called to get the provider to populate the Outline. |\n\n| Properties ||\n|----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| static [ViewOutlineProvider](#)! | [BACKGROUND](#BACKGROUND:android.view.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. |\n| static [ViewOutlineProvider](#)! | [BOUNDS](#BOUNDS:android.view.ViewOutlineProvider) Maintains the outline of the View to match its rectangular bounds, at `1.0f` alpha. |\n| static [ViewOutlineProvider](#)! | [PADDED_BOUNDS](#PADDED_BOUNDS:android.view.ViewOutlineProvider) Maintains the outline of the View to match its rectangular padded bounds, at `1.0f` alpha. |\n\nPublic constructors\n-------------------\n\n### ViewOutlineProvider\n\n```\nViewOutlineProvider()\n```\n\nPublic methods\n--------------\n\n### getOutline\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun getOutline(\n view: View!, \n outline: Outline!\n): Unit\n```\n\nCalled 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()](/reference/kotlin/android/view/View#invalidateOutline()) is called explicitly. The input outline is empty and has an alpha of `1.0f`.\n\n| Parameters ||\n|-----------|------------------------------------------------------------------------------|\n| `view` | [View](/reference/kotlin/android/view/View)!: The view building the outline. |\n| `outline` | [Outline](../graphics/Outline.html#)!: The empty outline to be populated. |\n\nProperties\n----------\n\n### BACKGROUND\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val BACKGROUND: ViewOutlineProvider!\n```\n\nDefault 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. \n**See Also**\n\n- [android.graphics.drawable.Drawable#getOutline(Outline)](../graphics/drawable/Drawable.html#getOutline(android.graphics.Outline)) \n\n### BOUNDS\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val BOUNDS: ViewOutlineProvider!\n```\n\nMaintains 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. \n\n### PADDED_BOUNDS\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val PADDED_BOUNDS: ViewOutlineProvider!\n```\n\nMaintains 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."]]