יש מצבים שבהם תרצו להציג באפליקציה הודעה מהירה למשתמש, בלי לחכות לתשובה שלו. לדוגמה, כשמשתמש מבצע פעולה כמו שליחת אימייל או מחיקה של קובץ, מוצגת באפליקציה הודעת אישור מהירה למשתמש. בדרך כלל, המשתמשים לא צריכים להשיב להודעה. ההודעה צריכה להיות בולטת מספיק כדי שהמשתמש יוכל לראות אותה, אבל לא בולטת מדי כדי למנוע מהמשתמש לעבוד עם האפליקציה.
ב-Android יש את הווידג'ט Snackbar לתרחיש לדוגמה הזה. Snackbar מציג הודעה קופצת מהירה למשתמש. הפעילות הנוכחית נשארת גלויה ואינטראקטיבית בזמן שהסמל Snackbar מוצג. אחרי זמן קצר, הSnackbar ייסגר באופן אוטומטי.
במסמך הזה מוסבר איך להשתמש ב-Snackbar כדי להציג הודעות קופצות.
איור 1. אם מופיע Snackbar, תוצג הודעה בחלק התחתון של הפעילות, אבל עדיין תוכלו להשתמש בשאר הפעילות.
כך מוסיפים פעולה להודעה כדי לאפשר למשתמש להשיב להודעה.
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-26 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-26 (שעון UTC)."],[],[],null,["# Pop-up messages overview\n\nTry the Compose way \nJetpack Compose is the recommended UI toolkit for Android. Learn how to add notifications in Compose. \n[Snackbar →](/develop/ui/compose/components/snackbar) \n\nThere are situations where you might want your app to show a quick message to the user, without\nnecessarily waiting for the user to respond. For example, when a user performs an action like\nsending an email or deleting a file, your app shows a quick confirmation to the user. Often, the\nuser doesn't need to respond to the message. The message needs to be prominent enough that the user\ncan see it, but not so prominent that it prevents the user from working with your app.\n\nAndroid provides the\n[Snackbar](/reference/com/google/android/material/snackbar/Snackbar)\nwidget for this common use case. A `Snackbar` provides a quick pop-up message to the\nuser. The current activity remains visible and interactive while the `Snackbar` is\ndisplayed. After a short time, the `Snackbar` automatically dismisses itself.\n\nThis documentation shows you how to use `Snackbar` to show pop-up messages. \n\n\n**Figure 1.** A `Snackbar`\nshows a message at the bottom of the\nactivity, and the rest of the activity is still usable.\n| **Note:** The `Snackbar` class supersedes [Toast](/reference/android/widget/Toast). While `Toast` is supported, `Snackbar` is the preferred way to display brief, transient messages to the user.\n\nAdditional resources\n--------------------\n\n\n**[Build and display a pop-up message](/develop/ui/views/notifications/snackbar/showing)**\n:\n Learn how to use a `Snackbar` to display\n a brief message to the user.\n\n\n**[Add an action to a message](/develop/ui/views/notifications/snackbar/action)**\n:\n Learn how to add an action to a message, letting the user respond to\n the message."]]