MaterialShapeUtils


Kotlin |Java

public class MaterialShapeUtils 


Utility methods for MaterialShapeDrawable and related classes.

Summary

Public methods

static void
setElevation(View view, float elevation)

If the background of the provided view is a MaterialShapeDrawable , sets the drawable's elevation via setElevation ; otherwise does nothing.

static void

If the background of the provided view is a MaterialShapeDrawable , sets the drawable's parent absolute elevation (see setParentAbsoluteElevation ); otherwise does nothing.

static void
setParentAbsoluteElevation(
View view,
MaterialShapeDrawable materialShapeDrawable
)

Updates the materialShapeDrawable parent absolute elevation via setParentAbsoluteElevation to be equal to the absolute elevation of the parent of the provided view.

Public methods

setElevation

public static void setElevation(View view, float elevation)

If the background of the provided view is a MaterialShapeDrawable , sets the drawable's elevation via setElevation ; otherwise does nothing.

setParentAbsoluteElevation

public static void setParentAbsoluteElevation(View view)

If the background of the provided view is a MaterialShapeDrawable , sets the drawable's parent absolute elevation (see setParentAbsoluteElevation ); otherwise does nothing.

setParentAbsoluteElevation

public static void setParentAbsoluteElevation(
View view,
MaterialShapeDrawable materialShapeDrawable
)

Updates the materialShapeDrawable parent absolute elevation via setParentAbsoluteElevation to be equal to the absolute elevation of the parent of the provided view.

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 2026年05月14日 UTC.