[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003eButtons in Android Automotive OS apps provide clear calls to action for drivers, coming in variations of icon only, label only, or a combination of both.\u003c/p\u003e\n"],["\u003cp\u003eThey are supported across various templates such as Pane, Message, Long Message, and Sign-in, as well as on the action strip within any template.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can customize button appearance with foreground and background colors, although vehicle OEMs might override these choices in AAOS.\u003c/p\u003e\n"],["\u003cp\u003ePrimary buttons can be designated for key actions, receiving visual emphasis like highlighting with an accent color, but OEMs can influence their color and placement.\u003c/p\u003e\n"],["\u003cp\u003eTimed buttons offer a built-in countdown timer for automatic actions if the user doesn't interact within a specified timeframe, enhancing user experience and streamlining interactions.\u003c/p\u003e\n"]]],[],null,["# Button\n\n\u003cbr /\u003e\n\nButtons provide access to actions that drivers may need to take --- for example,\nto confirm a choice or to return to the previous template. \n**Can include:**\n\n- Icon only\n- Label only\n- Icon + label\n\n\u003cbr /\u003e\n\nTemplate support\n----------------\n\nButtons are supported by the\n[Pane](/cars/design/create-apps/apps-for-drivers/templates/pane-template),\n[Message](/cars/design/create-apps/apps-for-drivers/templates/message-template),\n[Long Message](/cars/design/create-apps/apps-for-drivers/templates/long-message-template),\nand [Sign-in](/cars/design/create-apps/apps-for-drivers/templates/sign-in-template) templates,\nor on the [action strip](/cars/design/create-apps/apps-for-drivers/components/action-strip)\nin any template.\n\nGuidance\n--------\n\nYou can supply foreground and background colors to replace the default colors.\nHowever, note that vehicle OEMs can choose whether or not to use the colors you\nsupply in AAOS versions of your app. You can also specify which button is the\n[primary button](#primary) or create a [timed button](#timed) with a built-in\ntimer.\n\nKeep labels short to avoid truncation -- especially on the\n[Navigation template](/cars/design/create-apps/apps-for-drivers/templates/navigation-template),\nwhere there is less space than on other templates.\n\nPrimary buttons\n---------------\n\nIn certain templates that feature up to 2 buttons\n([Message](/cars/design/create-apps/apps-for-drivers/templates/message-template),\n[Long Message](/cars/design/create-apps/apps-for-drivers/templates/long-message-template),\nand [Pane](/cars/design/create-apps/apps-for-drivers/templates/pane-template)),\nyou can optionally tag one button as primary to represent the primary\naction. The primary button then gets special treatment in the UI, such as\nhighlighting with the app accent color, to enhance its prominence and usability.\n**Note:** On AAOS, vehicle OEMs can apply their own color to the primary button and determine its horizontal order for the other button. \nIn this Android Auto example, the primary button on\nthe Message template is colored with an accent color supplied by the app.\n\nIn this AAOS example, the vehicle OEM has applied its\nown accent color and chosen to put the primary button on the right.\n\n\u003cbr /\u003e\n\nTimed buttons\n-------------\n\nApps can create buttons associated with default actions that are taken\nautomatically if the user doesn't act within a specified amount of time\n(customizable by the app). For a sample flow using this strategy, see\n[Respond to a timed alert](/cars/design/create-apps/sample-flows/respond-to-timed-alert).\n\nTo convey the countdown to the user, the button itself becomes a timer, with a\nbuilt-in progress indicator. The timer countdown is indicated by the shading\nthat moves horizontally across the button.\n\nThe app library determines the timer color based on the app's suggested\nbackground color for the button, modifying it as needed to ensure sufficient\ncontrast.\n\nTo create a timed button, assign a\n[default flag](https://developer.android.com/reference/androidx/car/app/model/Action#FLAG_DEFAULT())\nto it.\n\n\u003cbr /\u003e\n\nIn these examples, the **Resume** or **Accept** action will automatically be\ntaken if the user doesn't choose the other action before the shaded progress\nindicator moves all the way across the button."]]