按钮
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
按钮可帮助用户发起操作或流程。您可以从不同类型的按钮中进行选择,以突出显示内容。

资源
亮点
- 根据操作的重要性选择按钮类型。
操作越重要,按钮的强调程度就越高。
- 按钮应带有明确的标签,以指明其执行的操作。
- 在屏幕上合理放置按钮,将其放置在用户可能预计会找到它们的位置。
- 不要过度使用按钮。屏幕上的按钮过多会破坏视觉层次结构。
按钮有 6 种类型:
- 填充按钮
- 轮廓按钮
- 图标按钮
- 轮廓图标按钮
- 长按按钮
- 图片按钮
根据操作的重要性选择按钮类型。
操作越重要,其按钮应越醒目。

填充型按钮的视觉效果最强,应用于完成流程的重要最终操作,例如“保存”“立即加入”“确认”或“下载”。
轮廓按钮是中度强调按钮。其中包含重要但不是应用中主要操作的操作。轮廓按钮与实心按钮搭配使用,可指示其他的次要操作。
解剖学

- 容器
- 标签文字
- 图标(可选)
状态
以可视化方式呈现组件的状态。

- 默认
- 专注
- 已按下
规范

使用图标按钮以紧凑的布局显示操作。图标按钮可以表示打开操作(例如打开菜单或搜索),也可以表示可开启和关闭的二进制操作(例如收藏或书签)。还可用于播放或暂停媒体。
图标按钮可定义为三种尺寸:小、中和大。
解剖学

- 容器
- 图标
状态

- 默认
- 专注
- 已按下
状态是用于传达组件或交互元素状态的直观表示。
规格

宽按钮比普通按钮更醒目。其中包含重要的操作。表示相关选项的按钮会归为一组。该组应共用一个常用 Surface。

- 容器
- 前置图标
- 标题
- 副标题

- 默认
- 专注
- 已按下
状态是用于传达组件或交互元素状态的直观表示。

图片按钮通常用于显示下一级导航中可用内容的缩略图。它们通常与相关操作一起分组,并且该组应共用一个常用界面。

- 容器
- 前置图标
- 标题
- 副标题
- 图片层,由以下内容组成:
- 纱罩(状态叠加层)
- 渐变(基于 Surface 颜色)
- 图片

- 默认
- 专注
- 已按下
状态是用于传达组件或交互元素状态的直观表示。

用法
按钮通常用于传达用户可以执行的操作。它们通常出现在对话框、模态窗口、表单、卡片和工具栏等界面元素中。
按钮只是在界面中表示操作的一种方式。请勿过度使用这些功能。屏幕上的按钮过多会破坏视觉层次结构。

- 容器
- 图标
- 标签文字
- 标题
- 副标题
- 图片
按钮会在内容周围显示一个容器。容器在聚焦时会放大 1.1 倍,同时保持内部内边距。以下是一些与容器相关的注意事项:
- 根据内容设置容器宽度,并使用一致的内边距。
- 设置容器相对于自适应布局网格的相对位置。
- 为填充的按钮使用纯色容器。
- 为轮廓按钮使用聚焦时的描边和填充颜色。获得焦点后,容器会获得填充颜色和轮廓。
- 对于宽按钮和图片按钮,容器宽度会根据布局网格进行设置。
- 容器的大小、位置和对齐方式可能会随着其父级容器的缩放而发生变化。

文本和图标按钮容器采用完全圆角设计。宽按钮和图片按钮容器的圆角容器为 12dp。
check_circle
正确做法
填充按钮的宽度可以根据布局网格进行自适应。当按钮宽度增加时,图标和标签文本会保持居中。
warning
注意
对于宽按钮和图片按钮,容器宽度由父容器定义。内容锚定到左侧。
图标
图标可直观地传达按钮的操作,并有助于吸引注意力。
它们应位于按钮的前端。图标始终在容器内垂直居中。
check_circle
正确做法
不同大小的图标按钮可以归为一组。
cancel
错误做法
请勿在按钮的中心垂直对齐图标和文本
warning
注意
请勿在同一按钮中使用两个图标
标签文字
标签文本是按钮最重要的元素。它描述了用户点按按钮时发生的操作。
对按钮标签文本采用句首字母大写格式,首字母和专有名词应大写。避免换行。为确保标签文本清晰易读,请将其保持在一行。
check_circle
正确做法
对按钮标签文本采用句首字母大写格式,首字母和专有名词应大写。
warning
注意
将轮廓按钮放在图片上方时,请确保标签文本清晰可辨;使用半透明层来保持对比度。
图片
图片按钮始终在背景图片上方显示渐变叠加层和半透明层。渐变叠加层会根据容器颜色进行设置。
scrim 会根据状态而变化。
按钮会在同一行或列中一起显示,以便在操作之间保持一致的导航。以下部分介绍了注意事项。
每个界面都应有一个主要操作,该操作由一个醒目的按钮(通常是宽按钮)表示。按钮应更易于查看和理解。
其他按钮应不那么醒目,也不应分散用户对主要操作的注意力。
由于焦点会先落在该组中的第一个按钮上,因此该按钮会用作主要操作。
保持线性布局
- 行布局
- 列布局
合理使用变体
在列布局中,应保留单个按钮变体。在行布局中,不同的款式/规格可以按按钮组的形式归为一类,但逻辑应清晰明了。填充和轮廓按钮可以在同一组中使用,但请确保操作层次结构清晰。
check_circle
正确做法
在按钮组中使用相同的按钮变体。
cancel
错误做法
在按钮组中混合使用长按钮和图片按钮。
warning
注意
在行布局中,文本按钮和图标按钮可以放在一起。确保主按钮的强调效果更强。
check_circle
正确做法
在列布局中,请仅使用一个按钮变体。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Buttons help users initiate actions or flow. Choose from different\ntypes of buttons to inform emphasis.\n\nResources\n---------\n\n| Type | Link | Status |\n|----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------|\n| Design | [Design source (Figma)](https://goo.gle/tv-desing-kit) | Available |\n| Implementation | [Jetpack Compose](/reference/kotlin/androidx/tv/material3/package-summary#Button(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function0,kotlin.Boolean,androidx.tv.material3.ButtonScale,androidx.tv.material3.ButtonGlow,androidx.tv.material3.ButtonShape,androidx.tv.material3.ButtonColors,androidx.compose.ui.unit.Dp,androidx.tv.material3.ButtonBorder,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function1)) | Available |\n\nHighlights\n----------\n\n- Choose the type of button based on the importance of the action. The more important the action is, the more emphasis on the button.\n- Buttons should have clear labels to indicate the action they perform.\n- Place buttons logically on the screen---where users likely expect to find them.\n- Don't overuse buttons. Too many buttons on a screen disrupt the visual hierarchy.\n\nVariants\n--------\n\nThere are six types of buttons:\n\n1. Filled button\n2. Outline button\n3. Icon button\n4. Outline icon button\n5. Long button\n6. Image button\n\nChoose the type of button based on the importance of the action.\nThe more important the action is, the more emphasis its button should have.\n\nFilled and outline button\n-------------------------\n\nFilled buttons have the most visual impact and should be used for important,\nfinal actions that complete a flow, like Save, Join now, Confirm, or Download.\n\nOutlined buttons are medium emphasis buttons. They contain actions that are\nimportant, but aren't the primary action in an app. Outlined buttons pair\nwell with filled buttons to indicate an alternative, secondary action.\n\n### Anatomy\n\n1. Container\n2. Label text\n3. Icon (optional)\n\n### States\n\nVisual representation of a component's status.\n\n1. Default\n2. Focused\n3. Pressed\n\n### Specification\n\nIcon and outline icon button\n----------------------------\n\nUse icon buttons to display actions in a compact layout. Icon buttons can\nrepresent opening actions such as opening an overflow menu or search, or\nrepresent binary actions that can be toggled on and off, such as favorite or\nbookmark. They are also used to play or pause media.\n\nIcon buttons can be defined in three sizes: small, medium and large.\n\n### Anatomy\n\n1. Container\n2. Icon\n\n### States\n\n1. Default\n2. Focused\n3. Pressed\n\nStates are visual representations used to communicate the status of\na component or interactive element.\n\n### Spec\n\nWide button\n-----------\n\nWide buttons are used for higher-emphasis than usual buttons.\nThey contain actions that are important. Buttons that represent related\noptions are grouped together. The group should share a common surface.\n\n### Anatomy\n\n1. Container\n2. Leading icon\n3. Title\n4. Subtitle\n\n### States\n\n1. Default\n2. Focused\n3. Pressed\n\nStates are visual representations used to communicate the status of\na component or interactive element.\n\n### Specifications\n\nImage button\n------------\n\nImage buttons are typically used to display thumbnails of the content that\nis available in the next level of navigation. They are usually grouped\ntogether with related actions, and the group should share a common surface.\n\n### Anatomy\n\n1. Container\n2. Leading icon\n3. Title\n4. Subtitle\n5. Image layer, which consists of:\n 1. Scrim (state overlay)\n 2. Gradient (based on surface color)\n 3. Image\n\n### States\n\n1. Default\n2. Focused\n3. Pressed\n\nStates are visual representations used to communicate the status of\na component or interactive element.\n\n### Spec\n\nUsage\n-----\n\nButtons are generally used to communicate actions that a user can take.\nThey are frequently found in UI elements such as dialogs, modal windows,\nforms, cards, and toolbars.\n\nButtons are just one option for representing actions in your UI. Don't\noveruse them. Too many buttons on a screen disrupts the visual hierarchy.\n\n1. Container\n2. Icon\n3. Label text\n4. Title\n5. Subtitle\n6. Image\n\n### Container\n\nButtons display a container around content. The container scales by 1.1x on\nfocus, maintaining the internal padding. Here are some considerations\nfor container:\n\n- Set container width based on content with consistent padding.\n- Set the container's relative position to the responsive layout grid.\n- Use solid color containers for filled buttons.\n- Use stroke and fill color on focus for outlined buttons. On focus, the container gets a fill color along with outline.\n- For wide and image buttons, container width is set according to the layout grid.\n- Container size, position, and alignment can change as its parent container scales.\n\nText and icon button containers have fully rounded corners. Wide and\nimage button containers have rounded containers of 12dp. \ncheck_circle\n\n### Do\n\nFilled button width can be responsive to the layout grid. Icons and label text remain centered when button width increases. \nwarning\n\n### Caution\n\nFor wide and image buttons, container width is defined by the parent container. Content anchors to the left.\n\n### Icon\n\nIcons visually communicate the button's action and help draw attention.\nThey should be placed on the leading side of the button. Icons are\nalways vertically centered within the container. \ncheck_circle\n\n### Do\n\nIcon buttons with different sizes can be grouped together. \ncancel\n\n### Don't\n\nDon't vertically align an icon and text in the center of a button \nwarning\n\n### Caution\n\nDon't use two icons in the same button\n\n### Label text\n\nLabel text is the most important element of a button. It describes\nthe action that occurs if a user taps a button.\n\nUse sentence case for button label text, capitalizing the first word\nand proper nouns. Avoid wrapping text. For maximum legibility, label text\nshould remain on a single line. \ncheck_circle\n\n### Do\n\nUse sentence case for button label text, capitalizing the first word and proper nouns. \nwarning\n\n### Caution\n\nEnsure legibility for label text when placing outlined buttons on top of images; use scrims to maintain contrast.\n\n### Image\n\nImage buttons always have a gradient overlay and scrim on top of the image in\nthe background. The gradient overlay is set according to container color.\nThe scrim changes according to state.\n\nButton groups\n-------------\n\nButtons appear together in a row or column to maintain consistent\nnavigation between actions. The following sections describe considerations.\n\n### Inform hierarchy\n\nEach screen should have one primary action that is represented by a prominent,\ntypically wide, button. The button should be easier to see and understand.\nOther buttons should be less prominent and shouldn't distract users from\nthe primary action.\n\nThe first button in the group acts as the primary action since focus\nlands on it first.\n\n### Maintain linear layout\n\n\n\u003cbr /\u003e\n\n1. Row layout\n2. Column layout\n\n### Use variants logically\n\nIn column layout, single button variants should be maintained. In\nrow layout, different variants can be clustered together in a button group\nbut the logic should be clear. Filled and outline buttons can be used in\nthe same group, but ensure clear hierarchy for actions. \ncheck_circle\n\n### Do\n\nUse the same button variants in a button group. \ncancel\n\n### Don't\n\nMix long buttons and image buttons in a button group. \nwarning\n\n### Caution\n\nIn row layout, text and icon buttons can be placed together. Ensure that the primary button has higher emphasis. \ncheck_circle\n\n### Do\n\nIn column layout, use only one button variant."]]