public enum WidgetSize
- Object
- Enum<WidgetSize>
- WidgetSize
ImplementsComparable<WidgetSize>
The size families a widget kind supports.
The first four are the phone families: iOS maps them to the WidgetKit families
(systemSmall / systemMedium / systemLarge, and accessoryRectangular for LOCKSCREEN);
Android and desktop treat them as size hints, and LOCKSCREEN is ignored on Android.
The WATCH_* families are complications – the small live readouts on a watch face. They
live here rather than in an API of their own because they are the same concept as a widget:
content-driven, rendered while your app is not running, and fed by the same WidgetTimeline. On
Apple a complication is literally a WidgetKit widget in an accessory family; on Wear OS the
simple families become complication data and the richer ones become a Tile.
Design them for a glance. A complication is a few dozen pixels someone reads in under a second,
so a SurfaceVector gauge or a single number beats any layout that has to be read.
Enum constants
SMALL | Small square home-screen widget. |
MEDIUM | Medium home-screen widget. |
LARGE | Large home-screen widget. |
LOCKSCREEN | Lock-screen widget. |
WATCH_CIRCULAR | Round complication – the corner or centre slots of a watch face. |
WATCH_RECTANGULAR | Wide complication, a band across the watch face. |
WATCH_INLINE | One line of text alongside the time. |
WATCH_CORNER | Curved complication hugging the bezel of a round face. |
Methods
public static WidgetSize[] values() | |
public static WidgetSize valueOf(String name) | |
public String getJsonName() | Returns the wire-format name used in the serialized descriptor. |
public boolean isWatchFamily() | True for the watch complication families, which are published to a watch face rather than to a home or lock screen. |
public static WidgetSize fromJsonName(String jsonName) | Resolves a wire-format name back to its family. |
Inherited methods
Enum constant details
SMALL
SMALLsystemSmall.MEDIUM
MEDIUMsystemMedium.LARGE
LARGEsystemLarge.LOCKSCREEN
LOCKSCREENaccessoryRectangular.WATCH_CIRCULAR
WATCH_CIRCULARaccessoryCircular;
Wear OS RANGED_VALUE or MONOCHROMATIC_IMAGE. Room for a gauge or one glyph.WATCH_RECTANGULAR
WATCH_RECTANGULARaccessoryRectangular; Wear OS
LONG_TEXT, or a Tile when the layout is richer than text. The roomiest family.WATCH_INLINE
WATCH_INLINEaccessoryInline; Wear OS SHORT_TEXT. Text only –
anything else is dropped.WATCH_CORNER
WATCH_CORNERaccessoryCorner; renders as the
circular family on Wear OS, which has no corner slot.Method details
values
public static WidgetSize[] values()valueOf
public static WidgetSize valueOf(String name)getJsonName
public String getJsonName()isWatchFamily
public boolean isWatchFamily()Returns
fromJsonName
public static WidgetSize fromJsonName(String jsonName)Parameters
jsonNameString- the name produced by
getJsonName()