RippleAlpha defines the alpha of the ripple / state layer for different Interactions.

On Android, because the press ripple is drawn using the framework's RippleDrawable, there are constraints / different behaviours for the actual press alpha used on different API versions. Note that this only affects pressedAlpha - the other values are guaranteed to be consistent, as they do not rely on framework code. Specifically:

API 21-27: The actual ripple is split into two 'layers', with the alpha applied to both layers, so there is no uniform 'alpha'. API 28-32: The ripple is just one layer, but the alpha is clamped to a maximum of 0.5f - it is not possible to have a fully opaque ripple. API 33: There is a bug where the ripple is clamped to a minimum of 0.5, instead of a maximum like before - this should be resolved in future versions.

Summary

Public constructors

RippleAlpha(
    draggedAlpha: Float,
    focusedAlpha: Float,
    hoveredAlpha: Float,
    pressedAlpha: Float
)
Cmn

Public functions

open operator Boolean
equals(other: Any?)
Cmn
open Int
Cmn
open String
Cmn

Public properties

Float

the alpha used when the ripple is dragged

Cmn
Float

the alpha used when the ripple is focused

Cmn
Float

the alpha used when the ripple is hovered

Cmn
Float

the alpha used when the ripple is pressed

Cmn

Public constructors

RippleAlpha

RippleAlpha(
    draggedAlpha: Float,
    focusedAlpha: Float,
    hoveredAlpha: Float,
    pressedAlpha: Float
)

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

toString

open fun toString(): String

Public properties

draggedAlpha

val draggedAlpha: Float

the alpha used when the ripple is dragged

focusedAlpha

val focusedAlpha: Float

the alpha used when the ripple is focused

hoveredAlpha

val hoveredAlpha: Float

the alpha used when the ripple is hovered

pressedAlpha

val pressedAlpha: Float

the alpha used when the ripple is pressed