SurfaceColors
public
final
enum
SurfaceColors
extends Enum<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
|
Inherited methods |
From class
java.lang.Enum
final
Object
|
clone()
|
final
int
|
compareTo(E arg0)
|
int
|
compareTo(Object arg0)
|
final
boolean
|
equals(Object arg0)
|
final
void
|
finalize()
|
final
Class<E>
|
getDeclaringClass()
|
final
int
|
hashCode()
|
final
String
|
name()
|
final
int
|
ordinal()
|
String
|
toString()
|
static
<T extends Enum<T>>
T
|
valueOf(Class<T> arg0, String arg1)
|
|
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()
|
|
From interface
java.lang.Comparable
abstract
int
|
compareTo(E arg0)
|
|
Enum values
Public methods
getColor
public int getColor (Context context)
Returns the tonal surface color value in RGB.
Parameters |
context |
Context |
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 |
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,["# SurfaceColors\n\nSummary: [Enums](#enumconstants) \\| [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \n\nSurfaceColors\n=============\n\n\n`\npublic\n\nfinal\n\nenum\nSurfaceColors\n`\n\n\n`\n\n\n`\n\n`\n\nextends Enum\u003c`[SurfaceColors](/reference/com/google/android/material/elevation/SurfaceColors)`\u003e\n\n\n`\n\n`\n\n\n`\n\n|---|---|-----------------------------------------------------|\n| java.lang.Object |||\n| ↳ | java.lang.Enum\\\u003c[com.google.android.material.elevation.SurfaceColors](/reference/com/google/android/material/elevation/SurfaceColors)\\\u003e ||\n| | ↳ | com.google.android.material.elevation.SurfaceColors |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nProvides a convenient way to get color values of tonal variations of `R.attr.colorSurface`.\n\nSummary\n-------\n\n| ### Enum values ||\n|---------------------------------------------------------------------------------|-------------|\n| [SurfaceColors](/reference/com/google/android/material/elevation/SurfaceColors) | `SURFACE_0` |\n| [SurfaceColors](/reference/com/google/android/material/elevation/SurfaceColors) | `SURFACE_1` |\n| [SurfaceColors](/reference/com/google/android/material/elevation/SurfaceColors) | `SURFACE_2` |\n| [SurfaceColors](/reference/com/google/android/material/elevation/SurfaceColors) | `SURFACE_3` |\n| [SurfaceColors](/reference/com/google/android/material/elevation/SurfaceColors) | `SURFACE_4` |\n| [SurfaceColors](/reference/com/google/android/material/elevation/SurfaceColors) | `SURFACE_5` |\n\n| ### Public methods ||\n|---------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` int` | ` `[getColor](/reference/com/google/android/material/elevation/SurfaceColors#getColor(android.content.Context))`(Context context) ` Returns the tonal surface color value in RGB. |\n| ` static int` | ` `[getColorForElevation](/reference/com/google/android/material/elevation/SurfaceColors#getColorForElevation(android.content.Context,%20float))`(Context context, float elevation) ` Returns the corresponding surface color in RGB with the given elevation. |\n| ` static `[SurfaceColors](/reference/com/google/android/material/elevation/SurfaceColors) | ` `[valueOf](/reference/com/google/android/material/elevation/SurfaceColors#valueOf(java.lang.String))`(String name) ` |\n| ` static final `[SurfaceColors[]](/reference/com/google/android/material/elevation/SurfaceColors) | ` `[values](/reference/com/google/android/material/elevation/SurfaceColors#values())`() ` |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From class ` java.lang.Enum ` |---------------------------------|-----------------------------------------| | ` final Object` | ` clone() ` | | ` final int` | ` compareTo(E arg0) ` | | ` int` | ` compareTo(Object arg0) ` | | ` final boolean` | ` equals(Object arg0) ` | | ` final void` | ` finalize() ` | | ` final Class\u003cE\u003e` | ` getDeclaringClass() ` | | ` final int` | ` hashCode() ` | | ` final String` | ` name() ` | | ` final int` | ` ordinal() ` | | ` String` | ` toString() ` | | ` static \u003cT extends Enum\u003cT\u003e\u003e T` | ` valueOf(Class\u003cT\u003e arg0, String arg1) ` | ||\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| From interface ` java.lang.Comparable ` |-----------------|-----------------------| | ` abstract int` | ` compareTo(E arg0) ` | ||\n\nEnum values\n-----------\n\n### SURFACE_0\n\n```\npublic static final SurfaceColors SURFACE_0\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n### SURFACE_1\n\n```\npublic static final SurfaceColors SURFACE_1\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n### SURFACE_2\n\n```\npublic static final SurfaceColors SURFACE_2\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n### SURFACE_3\n\n```\npublic static final SurfaceColors SURFACE_3\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n### SURFACE_4\n\n```\npublic static final SurfaceColors SURFACE_4\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n### SURFACE_5\n\n```\npublic static final SurfaceColors SURFACE_5\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nPublic methods\n--------------\n\n### getColor\n\n```\npublic int getColor (Context context)\n```\n\nReturns the tonal surface color value in RGB.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----------|------------------|\n| `context` | `Context` \u003cbr /\u003e |\n\n| Returns ||\n|-------|--------|\n| `int` | \u003cbr /\u003e |\n\n### getColorForElevation\n\n```\npublic static int getColorForElevation (Context context, \n float elevation)\n```\n\nReturns the corresponding surface color in RGB with the given elevation.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-------------|------------------|\n| `context` | `Context` \u003cbr /\u003e |\n| `elevation` | `float` \u003cbr /\u003e |\n\n| Returns ||\n|-------|--------|\n| `int` | \u003cbr /\u003e |\n\n### valueOf\n\n```\npublic static SurfaceColors valueOf (String name)\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Parameters ||\n|--------|-----------------|\n| `name` | `String` \u003cbr /\u003e |\n\n| Returns ||\n|---------------------------------------------------------------------------------|--------|\n| [SurfaceColors](/reference/com/google/android/material/elevation/SurfaceColors) | \u003cbr /\u003e |\n\n### values\n\n```\npublic static final SurfaceColors[] values ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|-----------------------------------------------------------------------------------|--------|\n| [SurfaceColors[]](/reference/com/google/android/material/elevation/SurfaceColors) | \u003cbr /\u003e |"]]