نقل مظاهر XML إلى Compose
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
عند تقديم Compose في تطبيق حالي، عليك نقل السمات بتنسيق XML لاستخدام MaterialTheme
لشاشات Compose. وهذا يعني أنّ تصميم تطبيقك سيتضمّن مصدرَين للحقيقة: التصميم المستند إلى العرض والتصميم المستند إلى Compose. يجب إجراء أي تغييرات على التصميم في مواضع متعددة. بعد نقل تطبيقك بالكامل إلى Compose، يمكنك إزالة تصميم XML.
لنقل مظاهر XML إلى Compose، استخدِم Material Theme Builder لنقل المظهر من XML إلى Material 3 في Compose. يمكنك استخدام أدوار الألوان الحالية، مثل الألوان الأساسية والثانوية من تصميم XML، وتمريرها إلى أداة Material Theme Builder. يؤدي ذلك إلى إنشاء مظهر Material 3 كامل في Compose وتوفير ملفات ألوان ومظاهر قابلة للتنزيل لاستخدامها في تطبيقك.
تنشئ أداة Material Theme Builder MaterialTheme
وأنظمة ألوان فاتحة وداكنة لتطبيقك. إذا كان تطبيقك يستخدم أشكالاً أو أساليب خطوط مخصّصة، يمكنك نقل الأشكال وأساليب الخطوط المخصّصة من خلال تحديد Shape
وTypography
على التوالي. بعد تحديدها، قدِّم هذه المعلومات إلى MaterialTheme
. لمزيد من المعلومات، يُرجى الاطّلاع على الأشكال وأسلوب الخط.
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-08-27 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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-27 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["When you introduce Compose in an existing app, you need to migrate your themes in XML to use `MaterialTheme` for Compose screens. This means your app's theming will have two sources of truth: the View-based theme and the Compose theme. Any changes to your styling need to be made in multiple places. Once your app is fully migrated to Compose, you can remove your XML theming.\n| **Note:** For non-Material design systems, see [Custom design systems in Compose](/develop/ui/compose/designsystems/custom).\n\nTo migrate your XML themes to Compose, use the [Material Theme Builder](https://m3.material.io/theme-builder) to migrate from an XML theme to [Material 3](/develop/ui/compose/designsystems/material3#material-theming) in Compose. You can use your existing color roles, such as primary and secondary colors from your XML theme, and pass them to the Material Theme Builder. This creates a fully Material 3 theme in Compose and provides downloadable color and theme files to use in your app.\n\nMaterial Theme Builder generates a `MaterialTheme` and light and dark color schemes for your app. If your app uses custom shapes or typography, migrate your custom shapes and typography by defining a `Shape` and `Typography`, respectively. Once defined, provide that information to your `MaterialTheme`. See [shapes](/develop/ui/compose/designsystems/material3#shapes) and [typography](/develop/ui/compose/designsystems/material3#typography) to learn more.\n| **Note:** If you are not using Material 3, see [Material Design 2 in Compose](/develop/ui/compose/designsystems/material) to learn how to create a theme. See [Migrate from Material 2 to Material 3 in Compose](/develop/ui/compose/designsystems/material2-material3) when you are ready to migrate to Material 3."]]