التلميحات
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
تجربة طريقة ComposeAllowed
Jetpack Compose هي مجموعة أدوات واجهة المستخدم التي ننصح بها لنظام التشغيل Android. تعرَّف على كيفية إضافة مكونات في Compose.
التلميح هو رسالة وصفية صغيرة تظهر بالقرب من طريقة العرض عند المستخدمين
الضغط مع الاستمرار على العرض أو تمرير الماوس فوقه. ويفيد ذلك في حال كان تطبيقك
تستخدم أيقونة لتمثيل إجراء أو جزء من المعلومات لتوفير مساحة في
التصميم. توضّح لك هذه الصفحة كيفية إضافة هذه التلميحات على Android 8.0 (مستوى واجهة برمجة التطبيقات).
26) وأعلى.
تتطلب بعض السيناريوهات، مثل تلك في تطبيقات الإنتاجية، طريقة وصفية
إيصال الأفكار والإجراءات. يمكنك استخدام التلميحات لعرض
رسالة وصفية، كما هو موضح في الشكل 1.

الشكل 1. تلميح معروض في تطبيق Android
تعرض بعض التطبيقات المصغّرة العادية تلميحات استنادًا إلى محتوى title
أو
موقعان (content description
) بدءًا من الإصدار Android 8.0، يمكنك تحديد
النص المعروض في التلميح بغض النظر عن قيمة الخصائص الأخرى.
تعيين نص التلميح
يمكنك تحديد نص التلميح في View
من خلال استدعاء
طريقة setTooltipText()
. يمكنك تحديد
السمة tooltipText
باستخدام سمة XML المقابلة أو واجهة برمجة التطبيقات.
لتحديد نص التلميح في ملفات XML، اضبط السمة android:tooltipText
على النحو الموضّح.
في المثال التالي:
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:tooltipText="Send an email" />
لتحديد نص التلميح في الرمز، استخدِم طريقة setTooltipText(CharSequence)
، كما هو موضَّح في المثال التالي:
Kotlin
val fab: FloatingActionButton = findViewById(R.id.fab)
fab.tooltipText = "Send an email"
Java
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setTooltipText("Send an email");
تتضمّن واجهة برمجة التطبيقات أيضًا طريقة getTooltipText()
التي يمكنك استخدامها لاسترداد قيمة السمة tooltipText
.
يعرض Android قيمة السمة tooltipText
عندما يمرِّر المستخدمون مؤشر الماوس فوق
ضع مؤشر الماوس فوق العرض أو اضغط مع الاستمرار على العرض.
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-07-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-07-27 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Tooltips\n\nTry the Compose way \nJetpack Compose is the recommended UI toolkit for Android. Learn how to add components in Compose. \n[Popup →](/reference/kotlin/androidx/compose/ui/window/package-summary#Popup(androidx.compose.ui.window.PopupPositionProvider,kotlin.Function0,androidx.compose.ui.window.PopupProperties,kotlin.Function0)) \n\n\u003cbr /\u003e\n\nA tooltip is a small descriptive message that appears near a view when users\nlong press the view or hover their mouse over it. This is useful when your app\nuses an icon to represent an action or piece of information to save space in the\nlayout. This page shows you how to add these tooltips on Android 8.0 (API level\n26) and higher.\n\nSome scenarios, such as those in productivity apps, require a descriptive method\nof communicating ideas and actions. You can use tooltips to display a\ndescriptive message, as shown in figure 1.\n\n**Figure 1.** Tooltip displayed in an Android app.\n\nSome standard widgets display tooltips based on the content of the `title` or\n`content description` properties. Starting in Android 8.0, you can specify the\ntext displayed in the tooltip regardless of the value of other properties.\n\nSetting the tooltip text\n------------------------\n\nYou can specify the tooltip text in a [View](/reference/android/view/View) by calling the\n[setTooltipText()](/reference/android/view/View#setTooltipText(java.lang.CharSequence)) method. You can set\nthe `tooltipText` property using the corresponding XML attribute or API.\n\nTo specify the tooltip text in your XML files, set the [android:tooltipText](/reference/android/R.styleable#View_tooltipText) attribute, as shown\nin the following example: \n\n \u003candroid.support.design.widget.FloatingActionButton\n android:id=\"@+id/fab\"\n android:tooltipText=\"Send an email\" /\u003e\n\nTo specify the tooltip text in your code, use the [setTooltipText(CharSequence)](/reference/android/view/View#setTooltipText(java.lang.CharSequence)) method, as shown in the following example: \n\n### Kotlin\n\n```kotlin\nval fab: FloatingActionButton = findViewById(R.id.fab)\nfab.tooltipText = \"Send an email\"\n```\n\n### Java\n\n```java\nFloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);\nfab.setTooltipText(\"Send an email\");\n```\n\nThe API also includes a [getTooltipText()](/reference/android/view/View#getTooltipText()) method that\nyou can use to retrieve the value of the `tooltipText` property.\n\nAndroid displays the value of the `tooltipText` property when users hover their\nmouse over the view or long press the view."]]