- 語法:
<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>
元素。 - 屬性:
- 導入版本:
- API 級別 1
- 另請參閱:
<permission>
<permission-group>
<uses-permission>
<權限樹狀結構>
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。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,["# <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)"]]