- 문법:
<property android:name="string" android:resource="resource specification" android:value="string" />
- 포함된 위치:
<activity>
<activity-alias>
<application>
<provider>
<receiver>
<service>
- 설명:
- 상위 구성요소에 제공될 수 있는 추가 임의 데이터 항목의 이름-값 쌍입니다. 구성요소 요소에는 여러
<property>
하위 요소가 포함될 수 있습니다. 유효한 이름에는PackageManager
클래스에 정의된 속성 상수,WindowProperties
와 같은 클래스에 정의된PackageManager.Property
태그, 임시로 정의된 임의의 상수가 포함되어 있습니다.PackageManager.getProperty()
메서드를 사용하여 값을 개별적으로 가져옵니다.android:value
속성을 사용하여 일반 값을 지정합니다.android:resource
속성을 사용하여 리소스 ID를 지정합니다.android:value
와android:resource
을 모두 지정하는 것은 유효하지 않습니다.예를 들어 다음 코드는
@string/kangaroo
리소스에 저장된 값을zoo
이름에 할당합니다.<property android:name="zoo" android:value=”@string/kangaroo” />
그러나 이 코드는 리소스에 저장된 값이 아니라 리소스의 숫자 ID를
zoo
에 할당합니다.<property android:name="zoo" android:resource=”@string/kangaroo” />
- 속성:
android:name
- 속성의 이름입니다. 여러 동위
<property>
태그가 이름이 같으면 파싱 오류가 발생합니다. android:resource
- 리소스의 참조입니다. 리소스 ID는 속성에 할당된 값입니다. ID는
PackageManager.Property.getResourceId()
로 속성에서 가져올 수 있습니다. android:value
- 속성에 할당된 값입니다. 다음 표에는 값 속성의 유효한 데이터 유형과 접근자 메서드가 나와 있습니다.
유형 PackageManager.Property 접근자 문자열: 문자를 이스케이프 처리하려면 이중 백슬래시(\\)를 사용합니다. 예를 들어 유니코드 문자의 경우 \\n
및\\uxxxxx
를 사용합니다.getString()
정수: 100
을 예로 들 수 있습니다.getInteger()
부울: true
또는false
입니다.getBoolean()
색상: #rgb
,#argb
,#rrggbb
또는#aarrggbb
형식입니다.getInteger()
부동 소수점 수: 1.23
을 예로 들 수 있습니다.getFloat()
참고:
<property>
태그에는android:value
속성과android:resource
속성이 모두 포함되면 안 됩니다. 포함되는 경우android:resource
를 포함하는 것이 좋습니다.- 도입 수준:
- API 수준 31
<속성>
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 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,["# <property\u003e\n\nsyntax:\n:\n\n ```xml\n \u003cproperty android:name=\"string\"\n android:resource=\"resource specification\"\n android:value=\"string\" /\u003e\n ```\n\ncontained in:\n: [\u003cactivity\u003e](/guide/topics/manifest/activity-element)\n\n [\u003cactivity-alias\u003e](/guide/topics/manifest/activity-alias-element)\n\n [\u003capplication\u003e](/guide/topics/manifest/application-element)\n\n [\u003cprovider\u003e](/guide/topics/manifest/provider-element)\n\n [\u003creceiver\u003e](/guide/topics/manifest/receiver-element)\n\n [\u003cservice\u003e](/guide/topics/manifest/service-element)\n\ndescription:\n: A name-value pair for an item of additional, arbitrary data that can be supplied to the\n parent component. A component element can contain any number of `\u003cproperty\u003e` subelements. Valid names\n include any of the [property constants](/reference/android/content/pm/PackageManager#constants_1) defined in\n the [PackageManager](/reference/android/content/pm/PackageManager) class,\n [PackageManager.Property](/reference/android/content/pm/PackageManager.Property) tags defined\n in classes such as [WindowProperties](/reference/kotlin/androidx/window/WindowProperties), and arbitrary constants defined ad hoc. Obtain values individually using the\n [PackageManager.getProperty()](/reference/android/content/pm/PackageManager#getProperty(java.lang.String,%20java.lang.String)) method.\n\n Specify ordinary values with the [android:value](/guide/topics/manifest/property-element#val)`\n ` attribute. Specify resource IDs with the\n [android:resource](/guide/topics/manifest/property-element#rsrc) attribute. Specifying\n both `android:value` and `android:resource` is invalid.\n\n\n For example, the following code assigns whatever value is stored in the `@string/kangaroo` resource to\n the `zoo` name:\n\n\n ```xml\n \u003cproperty android:name=\"zoo\" android:value=”@string/kangaroo” /\u003e\n ```\n\n\n The code here, however, assigns the numeric ID of the resource, not the value stored in the resource, to\n `zoo`:\n\n\n ```xml\n \u003cproperty android:name=\"zoo\" android:resource=”@string/kangaroo” /\u003e\n ```\n\nattributes:\n:\n\n `android:name`\n : The name of the property. A parsing error results if multiple, sibling `\u003cproperty\u003e` tags have the\n same name.\n\n `android:resource`\n : A reference to a resource. The ID of the resource is the value assigned to the property. The ID can be retrieved\n from the property by\n [PackageManager.Property.getResourceId()](/reference/android/content/pm/PackageManager.Property#getResourceId()).\n\n `android:value`\n : A value assigned to the property. The following table lists valid data types and accessor methods for the value\n attribute: \n\n\n | Type | PackageManager.Property accessor |\n |-----------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------|\n | String: Use double backslashes (\\\\\\\\) to escape characters; for example, `\\\\n` and `\\\\uxxxxx` for a Unicode character | [getString()](/reference/android/content/pm/PackageManager.Property#getString()) |\n | Integer: For example, `100` | [getInteger()](/reference/android/content/pm/PackageManager.Property#getInteger()) |\n | Boolean: Either `true` or `false` | [getBoolean()](/reference/android/content/pm/PackageManager.Property#getBoolean()) |\n | Color: In the form `#rgb`, `#argb`, `#rrggbb`, or `#aarrggbb` | [getInteger()](/reference/android/content/pm/PackageManager.Property#getInteger()) |\n | Float: For example, `1.23` | [getFloat()](/reference/android/content/pm/PackageManager.Property#getFloat()) |\n\n\nintroduced in:\n: API Level 31"]]