نظرة عامة على الميزات وواجهات برمجة التطبيقات

يقدّم Android 14 ميزات وواجهات برمجة تطبيقات رائعة للمطوّرين. وستساعدك ما يلي في التعرّف على ميزات تطبيقاتك والبدء في استخدام واجهات برمجة التطبيقات ذات الصلة.

للحصول على قائمة مفصّلة بواجهات برمجة التطبيقات التي تمت إضافتها وتعديلها وإزالتها، يُرجى الاطّلاع على تقرير اختلاف واجهات برمجة التطبيقات. للمزيد من التفاصيل حول واجهات برمجة التطبيقات التي تمت إضافتها، يُرجى الانتقال إلى مرجع واجهة برمجة تطبيقات Android. وبالنسبة إلى نظام التشغيل Android 14، يمكنك البحث عن واجهات برمجة التطبيقات التي تمت إضافتها في المستوى 34 من واجهة برمجة التطبيقات. للتعرّف على الجوانب التي قد تؤثر فيها تغييرات النظام الأساسي في تطبيقاتك، اطّلِع على التغييرات في سلوك نظام التشغيل Android 14 للتطبيقات التي تستهدف الإصدار 14 من نظام التشغيل Android ولجميع التطبيقات.

التوافق مع أسواق عالمية

إعدادات اللغة المخصصة حسب التطبيقات

Android 14 expands on the per-app language features that were introduced in Android 13 (API level 33) with these additional capabilities:

  • Automatically generate an app's localeConfig: Starting with Android Studio Giraffe Canary 7 and AGP 8.1.0-alpha07, you can configure your app to support per-app language preferences automatically. Based on your project resources, the Android Gradle plugin generates the LocaleConfig file and adds a reference to it in the final manifest file, so you no longer have to create or update the file manually. AGP uses the resources in the res folders of your app modules and any library module dependencies to determine the locales to include in the LocaleConfig file.

  • Dynamic updates for an app's localeConfig: Use the setOverrideLocaleConfig() and getOverrideLocaleConfig() methods in LocaleManager to dynamically update your app's list of supported languages in the device's system settings. Use this flexibility to customize the list of supported languages per region, run A/B experiments, or provide an updated list of locales if your app utilizes server-side pushes for localization.

  • App language visibility for input method editors (IMEs): IMEs can utilize the getApplicationLocales() method to check the language of the current app and match the IME language to that language.

واجهة برمجة التطبيقات النحوية للانعكاس

3 billion people speak gendered languages: languages where grammatical categories—such as nouns, verbs, adjectives, and prepositions—inflect according to the gender of people and objects you talk to or about. Traditionally, many gendered languages use masculine grammatical gender as the default or generic gender.

Addressing users in the wrong grammatical gender, such as addressing women in masculine grammatical gender, can negatively impact their performance and attitude. In contrast, a UI with language that correctly reflects the user's grammatical gender can improve user engagement and provide a more personalized and natural-sounding user experience.

To help you build a user-centric UI for gendered languages, Android 14 introduces the Grammatical Inflection API, which lets you add support for grammatical gender without refactoring your app.

الإعدادات المفضّلة لمنطقتك

Regional preferences enable users to personalize temperature units, the first day of the week, and numbering systems. A European living in the United States might prefer temperature units to be in Celsius rather than Fahrenheit and for apps to treat Monday as the beginning of the week instead of the US default of Sunday.

New Android Settings menus for these preferences provide users with a discoverable and centralized location to change app preferences. These preferences also persist through backup and restore. Several APIs and intents—such as getTemperatureUnit and getFirstDayOfWeek— grant your app read access to user preferences, so your app can adjust how it displays information. You can also register a BroadcastReceiver on ACTION_LOCALE_CHANGED to handle locale configuration changes when regional preferences change.

To find these settings, open the Settings app and navigate to System > Languages & input > Regional preferences.

Regional preferences screen in Android system settings.
Temperature options for regional preferences in Android system settings.

تسهيل الاستخدام

الضبط غير الخطّي لحجم الخط بنسبة 200%

بدءًا من نظام التشغيل Android 14، يتيح النظام إمكانية زيادة حجم الخط بنسبة تصل إلى 200%، ما يوفّر للمستخدمين ضعاف البصر خيارات إضافية لتسهيل الاستخدام تتوافق مع إرشادات إتاحة محتوى الويب (WCAG).

لمنع العناصر النصية الكبيرة على الشاشة من تغيير الحجم الكبير جدًا، يطبّق النظام منحنى تحجيم غير خطي. تعني استراتيجية التوسيع هذه أن النص الكبير لا يتم قياسه بنفس معدل النص الأصغر. يساعد ضبط الخط غير الخطي في الحفاظ على التسلسل الهرمي النسبي بين العناصر ذات الأحجام المختلفة مع تخفيف المشاكل المتعلقة بتحجيم النص الخطي بدرجات عالية (مثل اقتطاع النص أو النص الذي يصعب قراءته بسبب أحجام الشاشة الكبيرة جدًا).

اختبار تطبيقك باستخدام الضبط غير الخطّي للخط

يمكنك تفعيل الحد الأقصى لحجم الخط في إعدادات تسهيل الاستخدام على الجهاز لاختبار تطبيقك.

إذا كنت تستخدم وحدات البكسل (sp) المعدّلة لتحديد حجم النص، فسيتم تطبيق هذه الخيارات الإضافية وتحسينات التحجيم تلقائيًا على النص في تطبيقك. ومع ذلك، يجب إجراء اختبار واجهة المستخدم مع تفعيل الحد الأقصى لحجم الخط (%200) للتأكد من أن التطبيق يطبّق أحجام الخطوط بشكل صحيح ويمكنه استيعاب أحجام الخطوط الأكبر بدون التأثير على سهولة الاستخدام.

لتمكين حجم الخط بنسبة 200٪، اتبع الخطوات التالية:

  1. افتح تطبيق الإعدادات وانتقل إلى تسهيل الاستخدام > حجم شاشة العرض ونصها.
  2. بالنسبة إلى خيار حجم الخط، انقر على رمز علامة الجمع (+) إلى أن يتم تفعيل إعداد الحد الأقصى لحجم الخط، كما هو موضح في الصورة التي تصاحب هذا القسم.

استخدام وحدات البكسل (sp) المعدّلة لأحجام النصوص

وتذكَّر دائمًا تحديد أحجام النص بوحدات sp. عندما يستخدم تطبيقك وحدات sp، يمكن لنظام Android تطبيق حجم النص المفضّل لدى المستخدم وقياسه بشكل مناسب.

لا تستخدِم وحدات sp للمساحة المتروكة أو تحدِّد ارتفاعات العرض على افتراض أنّ مساحة متروكة ضمنية: عندما تكون أبعاد sp لقياس الخط غير الخطي قد لا تكون متناسبة، فإنّ 4sp + 20sp قد لا تساوي 24sp.

تحويل وحدات البكسل (sp) المعدّلة

استخدِم TypedValue.applyDimension() للتحويل من وحدات sp إلى وحدات بكسل، واستخدِم TypedValue.deriveDimension() لتحويل وحدات البكسل إلى وحدات بكسل. تطبق هذه الطرق تلقائيًا منحنى التحجيم غير الخطي المناسب.

تجنَّب معادلات الترميز الثابت باستخدام Configuration.fontScale أو DisplayMetrics.scaledDensity. ولأنّ ضبط حجم الخط غير خطي، لم يعُد حقل scaledDensity دقيقًا. يجب استخدام الحقل fontScale لأغراض توفير المعلومات فقط لأنّ الخطوط لم تعُد مصنّفة بقيمة عددية واحدة.

استخدام وحدات بكسل (sp) للارتفاع الخطي

حدِّد دائمًا android:lineHeight باستخدام وحدات sp بدلاً من dp، بحيث يتم ضبط ارتفاع السطر مع النص. وبخلاف ذلك، إذا كان النص sp وlineHeight بتنسيق dp أو px، لن يتغير حجم النص ويبدو ضيقًا. تصحح TextView lineHeight تلقائيًا بحيث يتم الحفاظ على النسب المقصودة، ولكن فقط إذا تم تحديد كل من textSize وlineHeight بوحدات sp.

الكاميرا والوسائط

دقة HDR فائقة للصور

An illustration of Standard Dynamic Range (SDR) versus High Dynamic Range (HDR) image quality.

Android 14 adds support for High Dynamic Range (HDR) images that retain more of the information from the sensor when taking a photo, which enables vibrant colors and greater contrast. Android uses the Ultra HDR format, which is fully backward compatible with JPEG images, allowing apps to seamlessly interoperate with HDR images, displaying them in Standard Dynamic Range (SDR) as needed.

Rendering these images in the UI in HDR is done automatically by the framework when your app opts in to using HDR UI for its Activity Window, either through a manifest entry or at runtime by calling Window.setColorMode(). You can also capture compressed Ultra HDR still images on supported devices. With more colors recovered from the sensor, editing in post can be more flexible. The Gainmap associated with Ultra HDR images can be used to render them using OpenGL or Vulkan.

التكبير/التصغير والتركيز وPostview والمزيد في إضافات الكاميرا

Android 14 upgrades and improves camera extensions, allowing apps to handle longer processing times, which enables improved images using compute-intensive algorithms like low-light photography on supported devices. These features give users an even more robust experience when using camera extension capabilities. Examples of these improvements include:

تكبير مع أداة استشعار

When REQUEST_AVAILABLE_CAPABILITIES_STREAM_USE_CASE in CameraCharacteristics contains SCALER_AVAILABLE_STREAM_USE_CASES_CROPPED_RAW, your app can use advanced sensor capabilities to give a cropped RAW stream the same pixels as the full field of view by using a CaptureRequest with a RAW target that has stream use case set to CameraMetadata.SCALER_AVAILABLE_STREAM_USE_CASES_CROPPED_RAW. By implementing the request override controls, the updated camera gives users zoom control even before other camera controls are ready.

صوت USB بدون فقدان البيانات

أصبح نظام التشغيل Android 14 متوافقًا مع تنسيقات الصوت بدون فقدان البيانات لتجارب محبي الموسيقى عبر سماعات الرأس السلكية USB. يمكنك طلب البحث عن سمات أداة المزج المفضّلة في جهاز USB، وتسجيل أداة معالجة التغييرات في سمات المزج المفضّلة، وإعداد سمات أداة المزج باستخدام الفئة AudioMixerAttributes. وتمثل هذه الفئة التنسيق، مثل قناع القناة ومعدّل العينة وسلوك أداة مزج الصوت. وتتيح هذه الفئة إرسال المحتوى الصوتي مباشرةً بدون خلط أو تعديل في الحجم أو تأثيرات للمعالجة.

إنتاجية المطوّرين وأدواته

مدير بيانات الاعتماد

Android 14 adds Credential Manager as a platform API, with additional support back to Android 4.4 (API level 19) devices through a Jetpack Library using Google Play services. Credential Manager aims to make sign-in easier for users with APIs that retrieve and store credentials with user-configured credential providers. Credential Manager supports multiple sign-in methods, including username and password, passkeys, and federated sign-in solutions (such as Sign-in with Google) in a single API.

Passkeys provide many advantages. For example, passkeys are built on industry standards, can work across different operating systems and browser ecosystems, and can be used with both websites and apps.

For more information, see the Credential Manager and passkeys documentation and the blogpost about Credential Manager and passkeys.

Health Connect

Health Connect is an on-device repository for user health and fitness data. It allows users to share data between their favorite apps, with a single place to control what data they want to share with these apps.

On devices running Android versions prior to Android 14, Health Connect is available to download as an app on the Google Play store. Starting with Android 14, Health Connect is part of the platform and receives updates through Google Play system updates without requiring a separate download. With this, Health Connect can be updated frequently, and your apps can rely on Health Connect being available on devices running Android 14 or higher. Users can access Health Connect from the Settings in their device, with privacy controls integrated into the system settings.

Users can get started using Health Connect without a separate app download on devices running Android 14 or higher.
Users can control which apps have access to their health and fitness data through system settings.

Health Connect includes several new features in Android 14, such as exercise routes, allowing users to share a route of their workout which can be visualized on a map. A route is defined as a list of locations saved within a window of time, and your app can insert routes into exercise sessions, tying them together. To ensure that users have complete control over this sensitive data, users must allow sharing individual routes with other apps.

For more information, see the Health Connection documentation and the blogpost on What's new in Android Health.

تحديثات OpenJDK 17

Android 14 continues the work of refreshing Android's core libraries to align with the features in the latest OpenJDK LTS releases, including both library updates and Java 17 language support for app and platform developers.

The following features and improvements are included:

  • Updated approximately 300 java.base classes to Java 17 support.
  • Text Blocks, which introduce multi-line string literals to the Java programming language.
  • Pattern Matching for instanceof, which allows an object to be treated as having a specific type in an instanceof without any additional variables.
  • Sealed classes, which allow you restrict which classes and interfaces can extend or implement them.

Thanks to Google Play system updates (Project Mainline), over 600 million devices are enabled to receive the latest Android Runtime (ART) updates that include these changes. This is part of our commitment to give apps a more consistent, secure environment across devices, and to deliver new features and capabilities to users independent of platform releases.

Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

تحسينات لمتاجر التطبيقات

يقدّم Android 14 العديد من واجهات برمجة تطبيقات PackageInstaller التي تسمح لمتاجر التطبيقات بتحسين تجربة المستخدم.

طلب الموافقة على التثبيت قبل التنزيل

قد يتطلب تثبيت أحد التطبيقات أو تحديثه موافقة المستخدم. على سبيل المثال، عندما يحاول مثبِّت يستخدم إذن REQUEST_INSTALL_PACKAGES تثبيت تطبيق جديد. في إصدارات Android السابقة، لا يمكن لمتاجر التطبيقات طلب موافقة المستخدم إلا بعد كتابة ملفات APK في جلسة التثبيت وتكون الجلسة الملزَمة.

بدءًا من نظام التشغيل Android 14، تتيح الطريقة requestUserPreapproval() للمثبِّتين طلب موافقة المستخدم قبل إتمام جلسة التثبيت. يتيح هذا التحسين لمتجر التطبيقات تأجيل تنزيل أي حِزم APK إلى أن يوافق المستخدم على عملية التثبيت. بالإضافة إلى ذلك، بعد موافقة المستخدم على تثبيت التطبيق، يمكن لمتجر التطبيقات تنزيل التطبيق وتثبيته في الخلفية بدون مقاطعة المستخدم.

المطالبة بالمسؤولية عن التحديثات المستقبلية

تسمح طريقة setRequestUpdateOwnership() للمثبت بالإشارة إلى النظام إلى أنه ينوي أن يكون مسؤولًا عن التحديثات المستقبلية للتطبيق الذي يثبّته. وتتيح هذه الميزة فرض تحديث الملكية، ما يعني أنّه يُسمح فقط لمالك التحديث بتثبيت التحديثات التلقائية للتطبيق. ويساعد تحديث فرض الملكية على ضمان تلقّي المستخدمين للتحديثات من متجر التطبيقات المتوقّع فقط.

يجب أن يحصل أي مثبّت آخر، بما في ذلك مَن يستفيد من إذن INSTALL_PACKAGES، على موافقة صريحة من المستخدم لتثبيت التحديث. إذا قرر المستخدم متابعة تحديث من مصدر آخر، ستفقد ملكية التحديث.

تحديث التطبيقات في أوقات أقل إزعاجًا

تحتاج متاجر التطبيقات عادةً إلى تجنُّب تحديث تطبيق قيد الاستخدام، لأن ذلك يؤدي إلى إنهاء عمليات التطبيق قيد التشغيل، ما قد يؤدي إلى مقاطعة ما كان يفعله المستخدم.

بدءًا من نظام التشغيل Android 14، تمنح واجهة برمجة التطبيقات InstallConstraints API للمثبّتي التطبيق طريقة لضمان إجراء تحديثات التطبيقات في الوقت المناسب. على سبيل المثال، يمكن لمتجر التطبيقات استدعاء طريقة commitSessionAfterInstallConstraintsAreMet() للتأكّد من إجراء تحديث فقط عندما لا يتفاعل المستخدم مع التطبيق المعنيّ.

تثبيت التقسيمات الاختيارية بسلاسة

أما مع حِزم APK المجزّأة، فيمكن تقديم ميزات التطبيق في ملفات APK منفصلة، بدلاً من عرض ميزات التطبيق كحزمة APK متجانسة. وتسمح حِزم APK المقسَّمة لمتاجر التطبيقات بتحسين عرض مكونات التطبيق المختلفة. على سبيل المثال، قد يتم تحسين متاجر التطبيقات بناءً على خصائص الجهاز المستهدف. توفّر واجهة برمجة التطبيقات PackageInstaller إمكانية التقسيمات منذ إطلاقها في المستوى 22 من واجهة برمجة التطبيقات.

في نظام التشغيل Android 14، تسمح طريقة setDontKillApp() لأداة التثبيت بالإشارة إلى أنّه يجب عدم إيقاف عمليات التشغيل في التطبيق عند تثبيت أقسام جديدة. يمكن لمتاجر التطبيقات استخدام هذه الميزة لتثبيت ميزات جديدة للتطبيق بسلاسة أثناء استخدام المستخدم للتطبيق.

حِزم البيانات الوصفية للتطبيقات

بدءًا من نظام التشغيل Android 14، تسمح لك أداة تثبيت حزمة Android بتحديد البيانات الوصفية للتطبيق، مثل ممارسات أمان البيانات، لتضمينها في صفحات متجر التطبيقات، مثل Google Play.

اكتشاف وقت أخذ المستخدمين للقطات شاشة من الجهاز

لإنشاء تجربة موحّدة لرصد لقطات الشاشة، يوفّر Android 14 واجهة برمجة تطبيقات لرصد لقطات الشاشة تحافظ على الخصوصية. تتيح واجهة برمجة التطبيقات هذه للتطبيقات تسجيل عمليات معاودة الاتصال على أساس كل نشاط. يتم استدعاء عمليات معاودة الاتصال هذه ويتم إعلام المستخدم عندما يأخذ المستخدم لقطة شاشة عندما يكون هذا النشاط مرئيًا.

تجربة المستخدم

الإجراءات المخصّصة في ورقة المشاركة والترتيب المحسّن

Android 14 updates the system sharesheet to support custom app actions and more informative preview results for users.

Add custom actions

With Android 14, your app can add custom actions to the system sharesheet it invokes.

Screenshot of custom actions on the sharesheet.

Improve ranking of Direct Share targets

Android 14 uses more signals from apps to determine the ranking of the direct share targets to provide more helpful results for the user. To provide the most useful signal for ranking, follow the guidance for improving rankings of your Direct Share targets. Communication apps can also report shortcut usage for outgoing and incoming messages.

Direct Share row in the sharesheet, as shown by 1

إتاحة الصور المتحركة المخصّصة والمضمّنة لميزة "إيماءة توقُّع الرجوع"

الفيديو: الصور المتحركة الخلفية القائمة على التوقّعات

قدّم Android 13 صورًا متحركة تنبؤية للعودة إلى المنزل تستند إلى خيار للمطوّرين. عند استخدام التمرير السريع في تطبيق متوافق مع تفعيل خيار مطوّر البرامج، يؤدي التمرير إلى الخلف إلى عرض صورة متحركة تشير إلى أن إيماءة الرجوع تؤدي إلى خروج التطبيق مرة أخرى إلى الشاشة الرئيسية.

يتضمّن Android 14 تحسينات متعدّدة وإرشادات جديدة لميزة "الرجوع" إلى "إيماءة إظهار شاشة الرجوع":

مع إصدار معاينة Android 14 هذا، لن تتوفّر جميع ميزات "الخلفية القائمة على التوقّعات" بخيار مخصّص للمطوّرين. يمكنك الاطّلاع على دليل المطوِّر حول نقل تطبيقك إلى الحالة السابقة القائمة على التوقّعات، بالإضافة إلى دليل المطوّر حول إنشاء عمليات نقل مخصّصة داخل التطبيق.

عمليات تجاوز الشركة المصنّعة للجهاز ذات الشاشة الكبيرة لكل تطبيق

Per-app overrides enable device manufacturers to change the behavior of apps on large screen devices. For example, the FORCE_RESIZE_APP override instructs the system to resize the app to fit display dimensions (avoiding size compatibility mode) even if resizeableActivity="false" is set in the app manifest.

Overrides are intended to improve the user experience on large screens.

New manifest properties enable you to disable some device manufacturer overrides for your app.

عمليات تجاوز المستخدم للشاشات الكبيرة لكل تطبيق

Per-app overrides change the behavior of apps on large screen devices. For example, the OVERRIDE_MIN_ASPECT_RATIO_LARGE device manufacturer override sets the app aspect ratio to 16:9 regardless of the app's configuration.

Android 14 QPR1 enables users to apply per‑app overrides by means of a new settings menu on large screen devices.

مشاركة شاشة التطبيق

App screen sharing enables users to share an app window instead of the entire device screen during screen content recording.

With app screen sharing, the status bar, navigation bar, notifications, and other system UI elements are excluded from the shared display. Only the content of the selected app is shared.

App screen sharing improves productivity and privacy by enabling users to run multiple apps but limit content sharing to a single app.

ميزة "الرد السريع" المستندة إلى النموذج اللغوي الكبير (LLM) في Gboard على Pixel 8 Pro

On Pixel 8 Pro devices with the December Feature Drop, developers can try out higher-quality smart replies in Gboard powered by on-device Large Language Models (LLMs) running on Google Tensor.

This feature is available as a limited preview for US English in WhatsApp, Line, and KakaoTalk. It requires using a Pixel 8 Pro device with Gboard as your keyboard.

To try it out, first enable the feature in Settings > Developer Options > AiCore Settings > Enable Aicore Persistent.

Next, open a conversation in a supported app to see LLM-powered Smart Reply in Gboard's suggestion strip in response to incoming messages.

Gboard utilizes on-device LLMs to provide higher-quality smart replies.

الرسومات

المسارات قابلة للاستعلام عنها وقابلة للاستيفاء

واجهة برمجة التطبيقات Path في Android هي آلية فعّالة ومرنة لإنشاء الرسومات المتّجهة وعرضها، مع إمكانية رسم مسار أو تعبئته، وإنشاء مسار من القطاعات الخطية أو المنحنيات التربيعية أو التكعيبية، أو تنفيذ عمليات منطقية للحصول على أشكال أكثر تعقيدًا، أو تنفيذ جميع هذه الإجراءات في الوقت نفسه. يتمثل أحد القيود في إمكانية اكتشاف ما هو موجود بالفعل في كائن Path (مسار)، حيث لا تكون العناصر الداخلية للكائن معتمة للمُتصِلين بعد الإنشاء.

لإنشاء Path، يمكنك استدعاء طرق مثل moveTo() وlineTo() وcubicTo() لإضافة أقسام المسار. ولكن لم تكن هناك طريقة تسأل عن ماهية المقاطع في هذا المسار، لذا يجب عليك الاحتفاظ بهذه المعلومات في وقت الإنشاء.

بدءًا من نظام التشغيل Android 14، يمكنك الاستعلام عن المسارات لمعرفة مضمونها. أولاً، يجب الحصول على عنصر PathIterator باستخدام Path.getPathIterator API:

Kotlin

val path = Path().apply {
    moveTo(1.0f, 1.0f)
    lineTo(2.0f, 2.0f)
    close()
}
val pathIterator = path.pathIterator

Java

Path path = new Path();
path.moveTo(1.0F, 1.0F);
path.lineTo(2.0F, 2.0F);
path.close();
PathIterator pathIterator = path.getPathIterator();

بعد ذلك، يمكنك استدعاء PathIterator للتكرار عبر الشرائح واحدة تلو الأخرى، واسترداد كل البيانات اللازمة لكل شريحة. يستخدم هذا المثال كائنات PathIterator.Segment التي تحزم البيانات لك:

Kotlin

for (segment in pathIterator) {
    println("segment: ${segment.verb}, ${segment.points}")
}

Java

while (pathIterator.hasNext()) {
    PathIterator.Segment segment = pathIterator.next();
    Log.i(LOG_TAG, "segment: " + segment.getVerb() + ", " + segment.getPoints());
}

لدى PathIterator أيضًا إصدار غير مخصّص من next() يمكنك من خلاله تمرير مخزن احتياطي للاحتفاظ ببيانات النقاط.

إحدى حالات الاستخدام المهمة للاستعلام عن بيانات Path هي الاستيفاء. على سبيل المثال، قد ترغب في تحريك (أو تحويل) بين مسارين مختلفين. ولتبسيط حالة الاستخدام هذه بشكل أكبر، يتضمّن Android 14 أيضًا طريقة interpolate() في Path. على افتراض أن المسارين لهما نفس البنية الداخلية، تقوم طريقة interpolate() بإنشاء Path جديد بهذه النتيجة المضافة. يعرض هذا المثال مسارًا يكون شكله في المنتصف (استيفاء خطيًا لرقم 5.) بين path وotherPath:

Kotlin

val interpolatedResult = Path()
if (path.isInterpolatable(otherPath)) {
    path.interpolate(otherPath, .5f, interpolatedResult)
}

Java

Path interpolatedResult = new Path();
if (path.isInterpolatable(otherPath)) {
    path.interpolate(otherPath, 0.5F, interpolatedResult);
}

توفّر مكتبة مسار الرسومات في Jetpack واجهات برمجة تطبيقات مشابهة للإصدارات السابقة من نظام التشغيل Android أيضًا.

شبكات مخصّصة مع أدوات تظليل الأجزاء الرأسية والأجزاء

Android has long supported drawing triangle meshes with custom shading, but the input mesh format has been limited to a few predefined attribute combinations. Android 14 adds support for custom meshes, which can be defined as triangles or triangle strips, and can, optionally, be indexed. These meshes are specified with custom attributes, vertex strides, varying, and vertex and fragment shaders written in AGSL.

The vertex shader defines the varyings, such as position and color, while the fragment shader can optionally define the color for the pixel, typically by using the varyings created by the vertex shader. If color is provided by the fragment shader, it is then blended with the current Paint color using the blend mode selected when drawing the mesh. Uniforms can be passed into the fragment and vertex shaders for additional flexibility.

عارض المخزن المؤقت للأجهزة للوحة الرسم

To assist in using Android's Canvas API to draw with hardware acceleration into a HardwareBuffer, Android 14 introduces HardwareBufferRenderer. This API is particularly useful when your use case involves communication with the system compositor through SurfaceControl for low-latency drawing.