androidx.glance.wear

Interfaces

WearWidgetData

Describes how a widget is rendered on a host.

Classes

GlanceWearWidget

Object that handles providing the contents of a Wear Widget.

GlanceWearWidgetManager

Manager for Glance Wear Widgets.

GlanceWearWidgetService

Service used for communication between the Host and a Widget Provider.

WearWidgetBrush

Defines a brush for a Wear Widget surface.

WearWidgetDocument

Defines the content of a widget using Remote Compose.

Objects

GlanceWearProfiles

Defines profiles for Glance Wear.

WearWidgetBrush.Companion

The WearWidgetBrush companion object is the empty, default, or starter WearWidgetBrush that contains no elements.

Annotations

AssociateWithGlanceWearWidget

Annotation used to associate a androidx.glance.wear.GlanceWearWidget class with its corresponding androidx.glance.wear.GlanceWearWidgetService.

ExperimentalGlanceWearApi

Denotes that this API surface is experimental.

Extension functions summary

WearWidgetBrush

Creates a WearWidgetBrush with a solid color.

WearWidgetBrush

Creates a WearWidgetBrush with a horizontal gradient and the given colors evenly dispersed within the gradient.

WearWidgetBrush
WearWidgetBrush.image(
    bitmap: RemoteImageBitmap,
    contentScale: ContentScale
)

Creates a WearWidgetBrush with a bitmap.

WearWidgetBrush

Creates a WearWidgetBrush with a vertical gradient and the given colors evenly dispersed within the gradient.

Extension functions

WearWidgetBrush.color

fun WearWidgetBrush.color(color: RemoteColor): WearWidgetBrush

Creates a WearWidgetBrush with a solid color.

Parameters
color: RemoteColor

The RemoteColor to use for the brush.

WearWidgetBrush.horizontalGradient

fun WearWidgetBrush.horizontalGradient(colors: List<RemoteColor>): WearWidgetBrush

Creates a WearWidgetBrush with a horizontal gradient and the given colors evenly dispersed within the gradient.

Because the gradient is drawn across the entire surface, tiling is not required. Therefore, TileMode defaults to TileMode.Clamp.

Example:

WearWidgetBrush.horizontalGradient(listOf(Color.Red.rc, Color.Green.rc, Color.Blue.rc))
Parameters
colors: List<RemoteColor>

The list of RemoteColors to be rendered as part of the gradient

WearWidgetBrush.image

fun WearWidgetBrush.image(
    bitmap: RemoteImageBitmap,
    contentScale: ContentScale = ContentScale.Fit
): WearWidgetBrush

Creates a WearWidgetBrush with a bitmap.

Because the image is drawn using TileMode.Decal, it does not repeat if the surface is larger than the scaled bitmap.

Example:

WearWidgetBrush.image(bitmap, ContentScale.Crop)
Parameters
bitmap: RemoteImageBitmap

The RemoteImageBitmap to draw.

contentScale: ContentScale = ContentScale.Fit

The ContentScale to apply to the bitmap when fitting it to the surface, by default ContentScale.Fit.

WearWidgetBrush.verticalGradient

fun WearWidgetBrush.verticalGradient(colors: List<RemoteColor>): WearWidgetBrush

Creates a WearWidgetBrush with a vertical gradient and the given colors evenly dispersed within the gradient.

Because the gradient is drawn across the entire surface, tiling is not required. Therefore, TileMode defaults to TileMode.Clamp.

Example:

WearWidgetBrush.verticalGradient(listOf(Color.Red.rc, Color.Green.rc, Color.Blue.rc))
Parameters
colors: List<RemoteColor>

The list of RemoteColors to be rendered as part of the gradient