- ไวยากรณ์:
<permission-tree android:icon="drawable resource" android:label="string resource" android:name="string" />
- ที่อยู่ใน:
<manifest>
- description:
- ประกาศชื่อฐานของแผนผังสิทธิ์ แอปพลิเคชันใช้เวลา
ความเป็นเจ้าของชื่อทั้งหมดภายในโครงสร้าง เพิ่มสิทธิ์ใหม่แบบไดนามิกได้
ต้นไม้โดยโทรหา
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
องค์ประกอบนี้จะไม่ประกาศสิทธิ์ใดๆ เลย มีเพียง Namespace ที่สามารถวางสิทธิ์ได้ ดูข้อมูลเพิ่มเติมเกี่ยวกับการประกาศสิทธิ์ได้ที่
<permission>
- ดังนี้
android:icon
- ไอคอนแสดงสิทธิ์ทั้งหมดในโครงสร้าง แอตทริบิวต์นี้ ต้องตั้งค่าเป็นการอ้างอิงไปยังทรัพยากรที่ถอนออกได้ที่มีรูปภาพ ของเรา
android:label
- ชื่อที่ผู้ใช้อ่านได้สำหรับกลุ่ม เพื่อความสะดวก ป้ายกำกับ สามารถตั้งค่าเป็นสตริงดิบได้โดยตรงในระหว่างการพัฒนา อย่างไรก็ตาม เมื่อแอปพลิเคชันพร้อมที่จะเผยแพร่ ให้กำหนดเป็น การอ้างอิงไปยังทรัพยากรสตริง เพื่อให้ระบบแปลได้อย่างอิสระ สตริงในอินเทอร์เฟซผู้ใช้
android:name
- ชื่อที่ฐานของแผนผังสิทธิ์ โดยใช้รูปแบบ
คำนำหน้าชื่อสิทธิ์ทั้งหมดในโครงสร้าง ใช้การกำหนดขอบเขตแบบ Java
เพื่อให้ชื่อไม่ซ้ำ ชื่อต้องมีมากกว่า
2 กลุ่มที่คั่นด้วยจุดในเส้นทาง ตัวอย่างเช่น
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)"]]