- نحو:
<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
- نام در پایه درخت مجوز. این به عنوان پیشوند برای همه نام های مجوز در درخت عمل می کند. از محدوده به سبک جاوا استفاده کنید تا نام منحصر به فرد باشد. نام باید بیش از دو بخش جدا شده با نقطه در مسیر خود داشته باشد. به عنوان مثال،
com.example.base
خوب است، اماcom.example
اینطور نیست.
-
- معرفی شده در:
- API سطح 1
- همچنین ببینید:
-
<permission>
<permission-group>
<uses-permission>
<permission-tree>
محتوا و نمونه کدها در این صفحه مشمول پروانههای توصیفشده در پروانه محتوا هستند. جاوا و OpenJDK علامتهای تجاری یا علامتهای تجاری ثبتشده Oracle و/یا وابستههای آن هستند.
تاریخ آخرین بهروزرسانی 2025-07-29 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","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-29 بهوقت ساعت هماهنگ جهانی."],[],[],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)"]]