Stay organized with collections
Save and categorize content based on your preferences.
public
class
InterpolateOnScrollPositionChangeHelper
extends Object
java.lang.Object
|
↳ |
com.google.android.material.shape.InterpolateOnScrollPositionChangeHelper
|
Helper class to handle shape interpolation when shaped views enter or exit the window.
Summary
Inherited methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
Public constructors
public InterpolateOnScrollPositionChangeHelper (View shapedView,
MaterialShapeDrawable materialShapeDrawable,
ScrollView containingScrollView)
Instantiate a scroll position helper.
Parameters |
shapedView |
View : the View whose background is a MaterialShapeDrawable and
which is scrolled in and out of view. |
materialShapeDrawable |
MaterialShapeDrawable : the MaterialShapeDrawable which will be interpolated. |
containingScrollView |
ScrollView : the ScrollView that contains shapedView.
|
Public methods
public void setContainingScrollView (ScrollView containingScrollView)
Set the ScrollView
which contains the View
being interpolated.
setMaterialShapeDrawable
public void setMaterialShapeDrawable (MaterialShapeDrawable materialShapeDrawable)
Set the MaterialShapeDrawable
which will be interpolated.
Parameters |
materialShapeDrawable |
MaterialShapeDrawable : the desired drawable.
|
public void startListeningForScrollChanges (ViewTreeObserver viewTreeObserver)
Start listening for scroll changes and interpolating based on position.
Parameters |
viewTreeObserver |
ViewTreeObserver : {@link ViewTreeObserver belonging to the {@link View} being
interpolated.
|
public void stopListeningForScrollChanges (ViewTreeObserver viewTreeObserver)
Stop listening for scroll changes and interpolating based on position.
Parameters |
viewTreeObserver |
ViewTreeObserver : {@link ViewTreeObserver belonging to the {@link View} being
interpolated.
|
updateInterpolationForScreenPosition
public void updateInterpolationForScreenPosition ()
Updates the MaterialShapeDrawable
's interpolation based on the View
's position
in the containing ScrollView
.
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.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# InterpolateOnScrollPositionChangeHelper\n\nSummary: [Ctors](#pubctors) \\| [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \n\nInterpolateOnScrollPositionChangeHelper\n=======================================\n\n\n`\npublic\n\n\nclass\nInterpolateOnScrollPositionChangeHelper\n`\n\n\n`\n\nextends Object\n\n\n`\n\n`\n\n\n`\n\n|---|---------------------------------------------------------------------------|\n| java.lang.Object ||\n| ↳ | com.google.android.material.shape.InterpolateOnScrollPositionChangeHelper |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nHelper class to handle shape interpolation when shaped views enter or exit the window.\n\nSummary\n-------\n\n| ### Public constructors ||\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| ` `[InterpolateOnScrollPositionChangeHelper](/reference/com/google/android/material/shape/InterpolateOnScrollPositionChangeHelper#InterpolateOnScrollPositionChangeHelper(android.view.View,%20com.google.android.material.shape.MaterialShapeDrawable,%20android.widget.ScrollView))`(View shapedView, `[MaterialShapeDrawable](/reference/com/google/android/material/shape/MaterialShapeDrawable)` materialShapeDrawable, ScrollView containingScrollView) ` Instantiate a scroll position helper. |\n\n| ### Public methods ||\n|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` void` | ` `[setContainingScrollView](/reference/com/google/android/material/shape/InterpolateOnScrollPositionChangeHelper#setContainingScrollView(android.widget.ScrollView))`(ScrollView containingScrollView) ` Set the [ScrollView](/reference/android/widget/ScrollView) which contains the [View](/reference/android/view/View) being interpolated. |\n| ` void` | ` `[setMaterialShapeDrawable](/reference/com/google/android/material/shape/InterpolateOnScrollPositionChangeHelper#setMaterialShapeDrawable(com.google.android.material.shape.MaterialShapeDrawable))`(`[MaterialShapeDrawable](/reference/com/google/android/material/shape/MaterialShapeDrawable)` materialShapeDrawable) ` Set the [MaterialShapeDrawable](/reference/com/google/android/material/shape/MaterialShapeDrawable) which will be interpolated. |\n| ` void` | ` `[startListeningForScrollChanges](/reference/com/google/android/material/shape/InterpolateOnScrollPositionChangeHelper#startListeningForScrollChanges(android.view.ViewTreeObserver))`(ViewTreeObserver viewTreeObserver) ` Start listening for scroll changes and interpolating based on position. |\n| ` void` | ` `[stopListeningForScrollChanges](/reference/com/google/android/material/shape/InterpolateOnScrollPositionChangeHelper#stopListeningForScrollChanges(android.view.ViewTreeObserver))`(ViewTreeObserver viewTreeObserver) ` Stop listening for scroll changes and interpolating based on position. |\n| ` void` | ` `[updateInterpolationForScreenPosition](/reference/com/google/android/material/shape/InterpolateOnScrollPositionChangeHelper#updateInterpolationForScreenPosition())`() ` Updates the [MaterialShapeDrawable](/reference/com/google/android/material/shape/MaterialShapeDrawable)'s interpolation based on the [View](/reference/android/view/View)'s position in the containing [ScrollView](/reference/android/widget/ScrollView). |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From class ` java.lang.Object ` |-------------------|-------------------------------| | ` Object` | ` clone() ` | | ` boolean` | ` equals(Object arg0) ` | | ` void` | ` finalize() ` | | ` final Class\u003c?\u003e` | ` getClass() ` | | ` int` | ` hashCode() ` | | ` final void` | ` notify() ` | | ` final void` | ` notifyAll() ` | | ` String` | ` toString() ` | | ` final void` | ` wait(long arg0, int arg1) ` | | ` final void` | ` wait(long arg0) ` | | ` final void` | ` wait() ` | ||\n\nPublic constructors\n-------------------\n\n### InterpolateOnScrollPositionChangeHelper\n\n```\npublic InterpolateOnScrollPositionChangeHelper (View shapedView, \n MaterialShapeDrawable materialShapeDrawable, \n ScrollView containingScrollView)\n```\n\nInstantiate a scroll position helper.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `shapedView` | `View`: the [View](/reference/android/view/View) whose background is a [MaterialShapeDrawable](/reference/com/google/android/material/shape/MaterialShapeDrawable) and which is scrolled in and out of view. \u003cbr /\u003e |\n| `materialShapeDrawable` | `MaterialShapeDrawable`: the [MaterialShapeDrawable](/reference/com/google/android/material/shape/MaterialShapeDrawable) which will be interpolated. \u003cbr /\u003e |\n| `containingScrollView` | `ScrollView`: the [ScrollView](/reference/android/widget/ScrollView) that contains shapedView. \u003cbr /\u003e |\n\nPublic methods\n--------------\n\n### setContainingScrollView\n\n```\npublic void setContainingScrollView (ScrollView containingScrollView)\n```\n\nSet the [ScrollView](/reference/android/widget/ScrollView) which contains the [View](/reference/android/view/View) being interpolated.\n\n\u003cbr /\u003e\n\n### setMaterialShapeDrawable\n\n```\npublic void setMaterialShapeDrawable (MaterialShapeDrawable materialShapeDrawable)\n```\n\nSet the [MaterialShapeDrawable](/reference/com/google/android/material/shape/MaterialShapeDrawable) which will be interpolated.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-------------------------|-------------------------------------------------------|\n| `materialShapeDrawable` | `MaterialShapeDrawable`: the desired drawable. \u003cbr /\u003e |\n\n### startListeningForScrollChanges\n\n```\npublic void startListeningForScrollChanges (ViewTreeObserver viewTreeObserver)\n```\n\nStart listening for scroll changes and interpolating based on position.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|--------------------|------------------------------------------------------------------------------------------------------|\n| `viewTreeObserver` | `ViewTreeObserver`: {@link ViewTreeObserver belonging to the {@link View} being interpolated. \u003cbr /\u003e |\n\n### stopListeningForScrollChanges\n\n```\npublic void stopListeningForScrollChanges (ViewTreeObserver viewTreeObserver)\n```\n\nStop listening for scroll changes and interpolating based on position.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|--------------------|------------------------------------------------------------------------------------------------------|\n| `viewTreeObserver` | `ViewTreeObserver`: {@link ViewTreeObserver belonging to the {@link View} being interpolated. \u003cbr /\u003e |\n\n### updateInterpolationForScreenPosition\n\n```\npublic void updateInterpolationForScreenPosition ()\n```\n\nUpdates the [MaterialShapeDrawable](/reference/com/google/android/material/shape/MaterialShapeDrawable)'s interpolation based on the [View](/reference/android/view/View)'s position\nin the containing [ScrollView](/reference/android/widget/ScrollView).\n\n\u003cbr /\u003e"]]