- תחביר:
<permission-tree android:icon="drawable resource" android:label="string resource" android:name="string" />
- בתוך:
<manifest>
- תיאור:
- מצהירה על שם הבסיס של עץ הרשאות. האפליקציה לוקחת
בעלות על כל השמות שבעץ. יכול להוסיף הרשאות חדשות באופן דינמי
לעץ באמצעות קריאה ל-
PackageManager.addPermission()
. השמות בתוך העץ מופרדים על ידי נקודות ('.
'). לדוגמה, אם שם הבסיס הואcom.example.project.taxes
, הרשאות כמו אלה עשויות להיות נוסף:com.example.project.taxes.CALCULATE
com.example.project.taxes.deductions.STORE_RECEIPTS
com.example.project.taxes.deductions.ACCESS_RECORDS
הרכיב הזה לא מצהיר על ההרשאה עצמה, אלא רק מרחב שמות שבו אפשר לקבל הרשאות. למידע נוסף על הצהרה על הרשאות, אפשר לעיין ב
<permission>
לרכיב מסוים. - :
android:icon
- סמל שמייצג את כל ההרשאות בעץ. המאפיין הזה צריך להיות מוגדר כהפניה למשאב ניתן להזזה שמכיל את התמונה להגדרה.
android:label
- שם לקבוצה, קריא למשתמשים. לנוחיותכם, מומלץ לסמן את התווית יכול להיות מוגדר ישירות כמחרוזת גולמית במהלך הפיתוח. אבל, לפעמים כשהאפליקציה מוכנה לפרסום, הגדירו אותה בתור הפניה למשאב מסוג 'מחרוזת', כך שיהיה אפשר להתאים אותו לשוק המקומי כמו מחרוזות בממשק המשתמש.
android:name
- השם בבסיס עץ ההרשאות. הוא משמש כ-
קידומת לכל שמות ההרשאות בעץ. שימוש בהיקף בסגנון Java
כדי שהשם יהיה ייחודי. השם חייב לכלול יותר מ-
שני פלחים המופרדים באמצעות נקודה בנתיב שלו. לדוגמה,
com.example.base
מותר, אבלcom.example
לא.
- הושקו ב:
- רמת API 1
- למידע נוסף:
<permission>
<permission-group>
<uses-permission>
<permission-tree>
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-27 (שעון UTC).
[[["התוכן קל להבנה","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 (שעון UTC)."],[],[],null,["# <permission-tree\u003e\n\nsyntax:\n:\n\n ```xml\n \u003cpermission-tree android:icon=\"drawable resource\"\n android:label=\"string resource\"\n android:name=\"string\" /\u003e\n ```\n\ncontained in:\n: [\u003cmanifest\u003e](/guide/topics/manifest/manifest-element)\n\ndescription:\n: Declares the base name for a tree of permissions. The application takes\n ownership of all names within the tree. It can dynamically add new permissions\n to the tree by calling [PackageManager.addPermission()](/reference/android/content/pm/PackageManager#addPermission(android.content.pm.PermissionInfo)).\n Names within the tree are separated by\n periods ('`.`'). For example, if the base name is\n `com.example.project.taxes`, permissions like the following might be\n added:\n\n `com.example.project.taxes.CALCULATE`\n\n `com.example.project.taxes.deductions.STORE_RECEIPTS`\n\n `com.example.project.taxes.deductions.ACCESS_RECORDS`\n\n\n This element doesn't declare a permission itself, only a\n namespace in which permissions can be placed. For more information about declaring permissions, see the\n [\u003cpermission\u003e](/guide/topics/manifest/permission-element)\n element.\n\nattributes:\n:\n\n `android:icon`\n : An icon representing all the permissions in the tree. This attribute\n must be set as a reference to a drawable resource containing the image\n definition.\n\n `android:label`\n : A user-readable name for the group. As a convenience, the label\n can be directly set as a raw string during development. However,\n when the application is ready to be published, set it as a\n reference to a string resource, so that it can be localized like other\n strings in the user interface.\n\n `android:name`\n : The name at the base of the permission tree. It serves as\n a prefix to all permission names in the tree. Use Java-style scoping\n so that the name is unique. The name must have more than\n two period-separated segments in its path. For example,\n `com.example.base` is OK, but `com.example` isn't.\n\nintroduced in:\n: API level 1\n\nsee also:\n: [\u003cpermission\u003e](/guide/topics/manifest/permission-element)\n\n [\u003cpermission-group\u003e](/guide/topics/manifest/permission-group-element)\n\n [\u003cuses-permission\u003e](/guide/topics/manifest/uses-permission-element)"]]