تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
يوضّح هذا المستند كيف يمكن أن يشكّل استخدام وجهات الحوار اعتبارات فريدة حول كيفية إدارة الحزمة السابقة.
نظرة عامة
يمكن أن تتوفّر وجهة واحدة أو أكثر لمربّعات الحوار فقط في أعلى الحزمة الخلفية.
ويرجع ذلك إلى أنّه عندما ينتقل المستخدم إلى وجهة أخرى ليست وجهة
مربّع حوار، تظهر علامة NavController تلقائيًا جميع وجهات مربّع الحوار من
أعلى الحزمة. يضمن ذلك أن تكون الوجهة الحالية مرئية بالكامل دائمًا فوق الوجهات الأخرى في الحزمة الخلفية.
إذا كانت حزمة الرجوع تتألف فقط من وجهات مستضافة
تملأ مضيف التنقّل، وتنقل المستخدم إلى وجهة مربّع حوار،
قد تبدو الحزمة الخلفية مشابهة للشكل 2:
الشكل 2. تكديس خلفية مع وجهة مربع حوار في الأعلى.
إذا انتقل المستخدم بعد ذلك إلى وجهة مربع حوار أخرى، فستتم إضافتها إلى الجزء
العلوي من الحزمة الخلفية، كما هو موضح في الشكل 3:
الشكل 3. حزمة خلفية تتضمّن وجهتين مع Dialog
في الأعلى
إذا انتقل المستخدم بعد ذلك إلى وجهة غير عائمة، تظهر أي وجهات
لمربع حوار أولاً من أعلى الحزمة الخلفية قبل الانتقال إلى
الوجهة الجديدة، كما هو موضّح في الشكل 4:
الشكل 4. تظهر وجهات Dialog
وتتم إضافة الوجهة الجديدة.
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-07-27 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-27 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Dialog destinations\n\nThis document outlines how the use of [dialog destinations](/guide/navigation/design) can introduce\nunique considerations for how you need to manage your back stack.\n\nOverview\n--------\n\nOne or more dialog destinations can only exist on the top of the back stack.\nThis is because when the user navigates to a destination that is not a dialog\ndestination, the `NavController` automatically pops all dialog destinations off\nthe top of the stack. This ensures that the current destination is always fully\nvisible over other destinations on the back stack.\n\nDestinations can be either [hosted destinations](/guide/navigation/design), [activity\ndestinations](/guide/navigation/design/activity-destinations), or [dialog destination](/guide/navigation/design/dialog-destinations).\n| **Note:** Dialog destinations implement the [`FloatingWindow`](/reference/androidx/navigation/FloatingWindow) interface. As such, they overlay other destinations on the back stack.\n\nExample\n-------\n\nIf the back stack consists solely of [hosted destinations](/guide/navigation/design)\nthat fill the navigation host, and the user navigates to a dialog destination,\nthen the back stack might look similar to figure 2:\n**Figure 2.** A back stack with a dialog destination on top.\n\nIf the user then navigates to another dialog destination, it is then added to\nthe top of the back stack, as shown in figure 3:\n**Figure 3.** A back stack with two `Dialog` destinations on top.\n\nIf the user then navigates to a non-floating destination, any dialog\ndestinations are first popped from the top of the back stack before navigating\nto the new destination, as shown in figure 4:\n**Figure 4.** The `Dialog` destinations are popped, and the new destination is added."]]