With Wear OS by Google, creating layouts for a watch is similar to creating them for a phone, except that you have to design for the screen size and for glanceability. Do not port the functionality and UI from a phone app to a watch and expect a good experience.
You should create custom layouts only when necessary. Read the Designing for Wear OS guidelines for information on designing great watch apps.
Create layouts with the Wear UI Library
The Wear UI Library is automatically included when you create your
watch app with the Android Studio Project Wizard. You can also add this
library to your build.gradle
file with the following
dependency declaration:
Groovy
dependencies { implementation 'androidx.wear:wear:1.0.0' implementation 'com.google.android.gms:play-services-wearable:+' }
Kotlin
dependencies { implementation("androidx.wear:wear:1.0.0") implementation("com.google.android.gms:play-services-wearable:+") }
This library helps you build UIs that are designed for watches. For more information, see Create custom UIs for Wear devices.
Here are some of the major classes:
-
BoxInsetLayout
-
A
FrameLayout
object that's aware of screen shape and can box its children in the center square of a round screen. -
ConfirmationActivity
- An activity that displays confirmation animations after the user completes an action.
-
AnimationSet
- A group of animations that should be played together.
-
CircularProgressLayout
- A layout that provides a circular countdown timer around a child view. Typically used as an automatic timer to confirm an operation after a short delay has elapsed.
-
SnapHelper
-
SnapHelper
supports snapping for aRecyclerView
object. -
PagerSnapHelper
-
Implementation of the
SnapHelper
instance supporting pager style snapping in either vertical or horizontal orientation. -
AlertDialog
- A subclass of Dialog that can display one, two or three buttons.
-
ProgressBar
- Displays a bar to the user representing how far the operation has progressed; the application can change the amount of progress (modifying the length of the bar) as it moves forward.
-
WearableRecyclerView
-
Wearable specific implementation of the
RecyclerView
class for displaying scrollable lists of items in square and round devices.
Wear UI Library API reference
The reference documentation explains how to use each UI widget in detail. Browse the Wear API reference documentation for the classes above.
Note:We recommend using Android Studio for Wear OS development, as it provides project setup, library inclusion, and packaging conveniences.