A sample that includes a pre-built TimeText
View
.
The component is included in the timetext library module, which includes the resources, layouts and tests for the component.
The TimeText
View
primarily displays the current time, which you should show on any long-lived overlay screen to give users quick access to the time.
On round screens, this time is displayed in a CurvedTextView
, while on square screens, the time is displayed in a normal TextView
.
Additionally, the TimeText
supports adding a title, which is displayed alongside the time.
This title can be set via TimeText.title
, or in XML via app:titleText
.
The title might be ellipsized if it is too long: On a square screen, the entire TimeText
is limited to a single line, and on a round screen, the entire TimeText
is limited to an angle of 90 degrees.
The color of this title can be controlled via TimeText.titleTextColor
, or in XML via android:titleTextColor
.
To use, include the TimeText
as an overlaying view that fills up the entire screen:
<com.example.android.wearable.timetext.TimeText
android:id="@+id/timeText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:titleTextColor="#82b1ff"
android:titleText="ABC" />
A sample is included in the wear module which allows editing the title via an EditText
.
- Android SDK 30
This sample uses the Gradle build system. To build this project, use the "gradlew build" command or use "Import Project" in Android Studio.
- Stack Overflow: http://stackoverflow.com/questions/tagged/android
If you've found an error in this sample, please file an issue: https://github.com/android/wear-os-samples/issues
Patches are encouraged, and may be submitted by forking this project and submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details.