- 語法:
<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.MAKE_SOME_UP
com.example.project.taxes.deductions.EXAGGERATE
請注意,這個元素不會宣告權限本身,只會宣告可放置後續權限的命名空間。如要瞭解如何宣告權限,請參閱
<permission>
元素的說明。 - 屬性:
android:icon
- 代表樹狀結構中所有權限的圖示。這項屬性必須設為包含圖片定義的可繪製資源參照。
android:label
- 使用者可理解的群組名稱。為了方便起見,您可以直接將標籤直接設為原始字串,以便快速進行骯髒程式設計。不過,當您準備發布應用程式時,請將其設定為字串資源的參照,這樣才能像使用者介面中的其他字串一樣進行本地化。
android:name
- 權限樹狀結構的基礎名稱,是樹狀結構中所有權限名稱的前置字串。請使用 Java 式範圍設定,確保名稱不重複。名稱的路徑必須包含超過兩個以半形句號分隔的部分。舉例來說,
com.example.base
符合這項條件,com.example
則不符合。
- 導入版本:
- API 級別 1
- 另請參閱:
<permission>
<permission-group>
<uses-permission>
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2022-05-01 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"缺少我需要的資訊"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"過於複雜/步驟過多"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"過時"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻譯問題"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"示例/程式碼問題"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"容易理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"確實解決了我的問題"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]