placeholderShimmer
Composable Function
Android
@Composable
public fun Modifier.placeholderShimmer(
placeholderState: PlaceholderState,
shape: Shape = PlaceholderDefaults.shape,
color: Color = PlaceholderDefaults.shimmerColor,
): Modifier
Modifier.placeholderShimmer draws a periodic shimmer over content, indicating to the user that
contents are loading or potentially out of date. The placeholder shimmer is a 45 degree gradient
from Top|Left of the screen to Bottom|Right. The shimmer is coordinated via the animation frame
clock which orchestrates the shimmer so that every component will shimmer as the gradient
progresses across the screen. NOTE: For animations to work, an AppScaffold
should be used.
Example of a Button
with icon and a label that put placeholders over individual content slots
and then draws a placeholder shimmer over the result:
Example of a simple text placeholder:
Parameters
placeholderState | the current placeholder state that determine whether the placeholder shimmer should be shown. |
shape | the shape of the component. |
color | the color to use in the shimmer. |