- 構文:
<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 スタイルのスコープを使用して、名前を一意にします。名前のパスには、ピリオドで区切られたセグメントが 2 つより多く含まれている必要があります。たとえば、
com.example.base
は問題ありませんが、com.example
は使用できません。
- 導入時の API レベル:
- 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)"]]