时间文本
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
TimeText
是一种在屏幕顶部显示当前时间的布局。

时间文本
使用时间文本可在屏幕顶部显示时间以及可选标签。当设备配备圆形屏幕时,时间文本为曲线样式。
当设备配备矩形屏幕时,时间文本为直线样式。
您可以为时间文本添加额外的前导内容标签。添加前导内容时,弧线的完整长度不应超过表盘的四分之一。
剖析
使用列表等可滚动元素创建
TimeText
时,请将
TimeText
设计为在元素滚动时淡出。使用
Modifier.scrollAway
,根据滚动状态垂直滚动
TimeText
,使其显示/不显示在视图中。
A. 前导内容
B. 分隔符
C. 时间
用法
如需在地图应用中显示预计到达时间,请使用包含前导内容的时间文本,如以下示例所示。

本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Time text\n\n[`TimeText`](/reference/kotlin/androidx/wear/compose/material/package-summary#TimeText(androidx.compose.ui.Modifier,androidx.wear.compose.material.TimeSource,androidx.compose.ui.text.TextStyle,androidx.compose.foundation.layout.PaddingValues,kotlin.Function0,kotlin.Function1,kotlin.Function0,kotlin.Function1,kotlin.Function0,kotlin.Function1))\nis a layout that shows the current time at the top of the screen.\n\n**Time Text**\n\nUse time text to display the time as well as an optional label on the top\nof the screen. When the device has a round screen time text is curved.\nWhen the device has a rectangular screen, time text is straight.\n\nYou can add an additional leading content label to the time text. When\nadding leading content, the full length of the arc should not be larger\nthan a quarter of the watch face.\n\nAnatomy\n-------\n\nWhen creating `TimeText` with scrollable elements such as lists, design the `TimeText` to fade away when the element scrolls. Use [Modifier.scrollAway](/reference/kotlin/androidx/wear/compose/material/package-summary#(androidx.compose.ui.Modifier).scrollAway(androidx.compose.foundation.ScrollState,androidx.compose.ui.unit.Dp)) to scroll `TimeText` vertically in and out of view, based on the scroll state.\n\n\n**A. Leading content\nB. Separator\nC. Time**\n\nUsage\n-----\n\nTo show the estimated time of arrival in a maps app, use time text with leading\ncontent as shown in the following example."]]