SurfaceColors
public
final
enum
SurfaceColors
extends Enum<SurfaceColors>
| java.lang.Object | ||
| ↳ | java.lang.Enum<com.google.android.material.elevation.SurfaceColors> | |
| ↳ | com.google.android.material.elevation.SurfaceColors | |
Provides a convenient way to get color values of tonal variations of R.attr.colorSurface.
Summary
Enum values | |
|---|---|
SurfaceColors |
SURFACE_0
|
SurfaceColors |
SURFACE_1
|
SurfaceColors |
SURFACE_2
|
SurfaceColors |
SURFACE_3
|
SurfaceColors |
SURFACE_4
|
SurfaceColors |
SURFACE_5
|
Public methods | |
|---|---|
int
|
getColor(Context context)
Returns the tonal surface color value in RGB. |
static
int
|
getColorForElevation(Context context, float elevation)
Returns the corresponding surface color in RGB with the given elevation. |
static
SurfaceColors
|
valueOf(String name)
|
static
final
SurfaceColors[]
|
values()
|
Inherited methods | |
|---|---|
Enum values
Public methods
getColor
public int getColor (Context context)
Returns the tonal surface color value in RGB.
| Parameters | |
|---|---|
context |
Context |
| Returns | |
|---|---|
int |
|
getColorForElevation
public static int getColorForElevation (Context context,
float elevation)Returns the corresponding surface color in RGB with the given elevation.
| Parameters | |
|---|---|
context |
Context |
elevation |
float |
| Returns | |
|---|---|
int |
|
valueOf
public static SurfaceColors valueOf (String name)
| Parameters | |
|---|---|
name |
String |
| Returns | |
|---|---|
SurfaceColors |
|
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.