با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
کلمات کلیدی: AiAssisted، محصول:JetpackCompose
دکمه ها اجزای اساسی هستند که به کاربر اجازه می دهند یک عمل تعریف شده را راه اندازی کند. پنج نوع دکمه وجود دارد. این جدول ظاهر هر یک از پنج نوع دکمه و همچنین محل استفاده از آنها را توضیح می دهد:
تایپ کنید
ظاهر
هدف
پر شده است
پس زمینه جامد با متن متضاد.
دکمه های با تاکید زیاد اینها برای اقدامات اولیه در یک برنامه کاربردی هستند، مانند «ارسال» و «ذخیره». افکت سایه اهمیت دکمه را برجسته می کند.
تونال پر شده
رنگ پس زمینه برای مطابقت با سطح متفاوت است.
همچنین برای اقدامات اولیه یا مهم. دکمه های تونال پر شده وزن بصری بیشتری را ارائه می دهند و عملکردهای مناسب تری مانند "افزودن به سبد خرید" و "ورود به سیستم" را ارائه می دهند.
مرتفع
با داشتن سایه متمایز می شود.
هدفی مشابه با دکمه های تونال دارد. ارتفاع را افزایش دهید تا دکمه حتی برجسته تر ظاهر شود.
مشخص شده است
دارای حاشیه بدون پر کردن.
دکمههای با تأکید متوسط، حاوی اقداماتی هستند که مهم هستند اما اصلی نیستند. آنها به خوبی با دکمه های دیگر جفت می شوند تا اقدامات ثانویه جایگزین مانند "لغو" یا "بازگشت" را نشان دهند.
متن
متنی را بدون پسزمینه یا حاشیه نمایش میدهد.
دکمههای کمتأکید، ایدهآل برای اقدامات کمتر مهم مانند پیوندهای ناوبری یا عملکردهای ثانویه مانند «بیشتر بدانید» یا «مشاهده جزئیات».
این تصویر پنج نوع دکمه در طراحی متریال را نشان می دهد:
شکل 1. پنج جزء دکمه.
سطح API
onClick
عملکردی که سیستم با فشار دادن دکمه توسط کاربر فراخوانی می کند.
enabled
هنگامی که false ، این پارامتر باعث می شود که دکمه در دسترس و غیرفعال به نظر برسد.
colors
نمونه ای از ButtonColors که رنگ های استفاده شده در دکمه را تعیین می کند.
contentPadding
بالشتک داخل دکمه.
دکمه پر شده
مولفه دکمه پر شده از Button اصلی قابل ترکیب استفاده می کند. به طور پیش فرض با یک رنگ ثابت پر شده است. قطعه نحوه پیاده سازی کامپوننت را نشان می دهد:
مولفه دکمه elevated از ElevatedButton composable استفاده می کند. دارای یک سایه است که به طور پیش فرض جلوه ارتفاع را نشان می دهد. این یک دکمه پر است که شامل یک سایه است.
محتوا و نمونه کدها در این صفحه مشمول پروانههای توصیفشده در پروانه محتوا هستند. جاوا و OpenJDK علامتهای تجاری یا علامتهای تجاری ثبتشده Oracle و/یا وابستههای آن هستند.
تاریخ آخرین بهروزرسانی 2025-08-28 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2025-08-28 بهوقت ساعت هماهنگ جهانی."],[],[],null,["keywords: AiAssisted, product:JetpackCompose\n\nButtons are fundamental components that allow the user to trigger a defined\naction. There are five types of buttons. This table describes the\nappearance of each of the five button types, as well as where you should use\nthem:\n\n| Type | Appearance | Purpose |\n|--------------|-----------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Filled | Solid background with contrasting text. | High-emphasis buttons. These are for primary actions in an application, such as \"submit\" and \"save.\" The shadow effect highlights the button's importance. |\n| Filled tonal | Background color varies to match the surface. | Also for primary or significant actions. Filled tonal buttons provide more visual weight and suit functions such as \"add to cart\" and \"Sign in.\" |\n| Elevated | Stands out by having a shadow. | Serves a similar purpose to tonal buttons. Increase elevation to make the button appear even more prominently. |\n| Outlined | Features a border with no fill. | Medium-emphasis buttons, containing actions that are important but not primary. They pair well with other buttons to indicate alternative, secondary actions like \"Cancel\" or \"Back.\" |\n| Text | Displays text with no background or border. | Low-emphasis buttons, ideal for less critical actions such as navigational links, or secondary functions like \"Learn More\" or \"View details.\" |\n\nThis image demonstrates the five types of buttons in Material Design:\nFigure 1. The five button components.\n\nAPI surface\n\n`onClick`\n: The function that the system calls when the user presses the button.\n\n`enabled`\n: When `false`, this parameter makes the button appear unavailable and\n inactive.\n\n`colors`\n: An instance of `ButtonColors` that determines the colors used in the\n button.\n\n`contentPadding`\n: The padding within the button.\n\nFilled button\n\nThe filled button component uses the basic [`Button`](/reference/kotlin/androidx/compose/material3/package-summary?#Button(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Boolean,androidx.compose.ui.graphics.Shape,androidx.compose.material3.ButtonColors,androidx.compose.material3.ButtonElevation,androidx.compose.foundation.BorderStroke,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function1)) composable. It is\nfilled with a solid color by default. The snippet shows how to implement the\ncomponent:\n\n\n```kotlin\n@Composable\nfun FilledButtonExample(onClick: () -\u003e Unit) {\n Button(onClick = { onClick() }) {\n Text(\"Filled\")\n }\n}https://github.com/android/snippets/blob/7a0ebbee11495f628cf9d574f6b6069c2867232a/compose/snippets/src/main/java/com/example/compose/snippets/components/Button.kt#L58-L63\n```\n\n\u003cbr /\u003e\n\n| **Note:** If you want to build a custom button, use the `Button` composable.\n\nThis implementation appears as shown:\nFigure 2. A filled button.\n\nFilled tonal button\n\nThe filled tonal button component uses the [`FilledTonalButton`](/reference/kotlin/androidx/compose/material3/package-summary#FilledTonalButton(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Boolean,androidx.compose.ui.graphics.Shape,androidx.compose.material3.ButtonColors,androidx.compose.material3.ButtonElevation,androidx.compose.foundation.BorderStroke,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function1)) composable.\nIt is filled with a tonal color by default.\n\nThe snippet shows how to implement the component:\n\n\n```kotlin\n@Composable\nfun FilledTonalButtonExample(onClick: () -\u003e Unit) {\n FilledTonalButton(onClick = { onClick() }) {\n Text(\"Tonal\")\n }\n}https://github.com/android/snippets/blob/7a0ebbee11495f628cf9d574f6b6069c2867232a/compose/snippets/src/main/java/com/example/compose/snippets/components/Button.kt#L67-L72\n```\n\n\u003cbr /\u003e\n\nThis implementation appears as shown:\nFigure 3. A tonal button.\n\nOutlined button\n\nThe outlined button component uses the [`OutlinedButton`](/reference/kotlin/androidx/compose/material3/package-summary#OutlinedButton(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Boolean,androidx.compose.ui.graphics.Shape,androidx.compose.material3.ButtonColors,androidx.compose.material3.ButtonElevation,androidx.compose.foundation.BorderStroke,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function1)) composable. It\nappears with an outline by default.\n\nThe snippet shows how to implement the component:\n\n\n```kotlin\n@Composable\nfun OutlinedButtonExample(onClick: () -\u003e Unit) {\n OutlinedButton(onClick = { onClick() }) {\n Text(\"Outlined\")\n }\n}https://github.com/android/snippets/blob/7a0ebbee11495f628cf9d574f6b6069c2867232a/compose/snippets/src/main/java/com/example/compose/snippets/components/Button.kt#L85-L90\n```\n\n\u003cbr /\u003e\n\nThis implementation appears as shown:\nFigure 4. An outlined button.\n\nElevated button\n\nThe elevated button component uses the [`ElevatedButton`](/reference/kotlin/androidx/compose/material3/package-summary#ElevatedButton(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Boolean,androidx.compose.ui.graphics.Shape,androidx.compose.material3.ButtonColors,androidx.compose.material3.ButtonElevation,androidx.compose.foundation.BorderStroke,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function1)) composable. It has\na shadow that represents the elevation effect by default. It is a filled button\nthat includes a shadow.\n\nThe snippet shows how to implement the component:\n\n\n```kotlin\n@Composable\nfun ElevatedButtonExample(onClick: () -\u003e Unit) {\n ElevatedButton(onClick = { onClick() }) {\n Text(\"Elevated\")\n }\n}https://github.com/android/snippets/blob/7a0ebbee11495f628cf9d574f6b6069c2867232a/compose/snippets/src/main/java/com/example/compose/snippets/components/Button.kt#L76-L81\n```\n\n\u003cbr /\u003e\n\nThis implementation appears as shown:\nFigure 5. An elevated button.\n\nText button\n\nThe text button component uses the [`TextButton`](/reference/kotlin/androidx/compose/material3/package-summary#TextButton(kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Boolean,androidx.compose.ui.graphics.Shape,androidx.compose.material3.ButtonColors,androidx.compose.material3.ButtonElevation,androidx.compose.foundation.BorderStroke,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function1)) composable. It appears as\nonly text until pressed. It does not have a solid fill or outline by default.\n\nThe snippet shows how to implement the component:\n\n\n```kotlin\n@Composable\nfun TextButtonExample(onClick: () -\u003e Unit) {\n TextButton(\n onClick = { onClick() }\n ) {\n Text(\"Text Button\")\n }\n}https://github.com/android/snippets/blob/7a0ebbee11495f628cf9d574f6b6069c2867232a/compose/snippets/src/main/java/com/example/compose/snippets/components/Button.kt#L94-L101\n```\n\n\u003cbr /\u003e\n\nThis implementation appears as shown:\nFigure 6. A text button.\n\nAdditional resources\n\n- [Floating action button](/develop/ui/compose/components/fab)\n- [Material Design 3 Buttons overview](https://m3.material.io/components/buttons/overview)"]]