按钮
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003eButtons are standard Android components that communicate actions, appearing as filled (primary) or unfilled.\u003c/p\u003e\n"],["\u003cp\u003eButtons can be customized with icons, fonts, colors, dimensions, and motion feedback.\u003c/p\u003e\n"],["\u003cp\u003eButton placement varies; in app bars they're on the right, while in dialogs they're typically bottom left.\u003c/p\u003e\n"],["\u003cp\u003eMinimum button width is 156dp and maximum label length is 20 characters, with icons appearing to the left of text.\u003c/p\u003e\n"],["\u003cp\u003eOEMs can customize button appearance, including accent color, icons, fonts, and states, guided by the Car UI Library Integration Guide and Design system.\u003c/p\u003e\n"]]],[],null,["# Buttons\n\n\u003cbr /\u003e\n\nA button communicates an action that will occur when a user touches it.\n\nButtons are standard Android Open Source Project (AOSP) components. They can either be filled with a solid background color, or unfilled (with a transparent background). Filled buttons indicate a primary or preferred action. Buttons can appear independently or in groups -- unlike [tabs](/cars/design/automotive-os/components/tabs), which always appear in groups.\n\n*** ** * ** ***\n\nAnatomy\n-------\n\n1. Unfilled button container \n2. Filled button container, indicating the primary or preferred action \n3. Button label\n\n*** ** * ** ***\n\nSpecs\n-----\n\n### Button min and max length\n\nMaximum button label length is 20 characters. Minimum button width is 156dp.\n\n### Button with icon vs. default button\n\nButtons can include icons. When included, icons typically appear to the left of button text.\n\nButtons can appear as elements in other components, such as the [app bar](/cars/design/automotive-os/components/app-bar) or [dialogs](/cars/design/automotive-os/components/dialogs).\n\n### Button placement in app bar\n\nButtons are placed on the right side of the app bar\n\n### Button in dialog\n\nButtons in dialogs are typically located at the bottom left side of a dialog\n\n### Hero button\n\nThe rounded edges of a hero button emphasize its importance\n\n*** ** * ** ***\n\nCustomization\n-------------\n\nOEMs can reflect their brand by modifying a button's visual appearance, such as:\n\n- Specifying an accent color\n- Supplying custom icons\n- Adding custom fonts\n- Changing the appearance of active, inactive, and disabled buttons\n- Setting button dimensions, corner shape, and placements\n- Using motion to provide feedback to users\n\nThe [Car UI Library Integration Guide](https://source.android.com/devices/automotive/hmi/car_ui) provides OEM guidance for customizing components.\n\n[Design system](/cars/design/automotive-os/design-system/overview) provides specific guidance for using layout, color, typography, sizing, shape, and motion to customize components.\n\n*** ** * ** ***\n\nExamples\n--------\n\nUnfilled and filled buttons, where the filled button indicates the primary action This filled button's color and opacity indicate a disabled state\nUnfilled buttons in a dialog indicate equally-weighted actions These ripple motions have a duration of 330ms. They're used to confirm user contact with a button. These ripple motions initially overlay 60% of the button surface. They expand away from the user's tap, and stop 10dp from the button's edge."]]