Android API Guides 之 App Manifest(13) - <meta-data>
来源:互联网 发布:微电影知乎 编辑:程序博客网 时间:2024/05/01 00:31
<meta-data>
- SYNTAX:
<meta-data android:name="string" android:resource="resource specification" android:value="string" />
- CONTAINED IN:
<activity>
<activity-alias>
<application>
<provider>
<receiver>
<service>
- DESCRIPTION:
- A name-value pair for an item of additional, arbitrary data that can be supplied to the parent component. A component element can contain any number of
<meta-data>
subelements. The values from all of them are collected in a singleBundle
object and made available to the component as thePackageItemInfo.metaData
field.Ordinary values are specified through the
value
attribute. However, to assign a resource ID as the value, use theresource
attribute instead. For example, the following code assigns whatever value is stored in the@string/kangaroo
resource to the "zoo
" name:<meta-data android:name="zoo" android:value="@string/kangaroo" />
On the other hand, using the
resource
attribute would assign "zoo
" the numeric ID of the resource, not the value stored in the resource:<meta-data android:name="zoo" android:resource="@string/kangaroo" />
It is highly recommended that you avoid supplying related data as multiple separate
<meta-data>
entries. Instead, if you have complex data to associate with a component, store it as a resource and use theresource
attribute to inform the component of its ID. - ATTRIBUTES:
android:name
- A unique name for the item. To ensure that the name is unique, use a Java-style naming convention — for example, "
com.example.project.activity.fred
". android:resource
- A reference to a resource. The ID of the resource is the value assigned to the item. The ID can be retrieved from the meta-data Bundle by the
Bundle.getInt()
method. android:value
- The value assigned to the item. The data types that can be assigned as values and the Bundle methods that components use to retrieve those values are listed in the following table:
Type Bundle method String value, using double backslashes (\\
) to escape characters — such as "\\n
" and "\\uxxxxx
" for a Unicode character.getString()
Integer value, such as "100
"getInt()
Boolean value, either "true
" or "false
"getBoolean()
Color value, in the form "#rgb
", "#argb
", "#rrggbb
", or "#aarrggbb
"getInt()
Float value, such as "1.23
"getFloat()
- INTRODUCED IN:
- API Level 1
0 0
- Android API Guides 之 App Manifest(13) - <meta-data>
- Android API Guides---App Manifest <manifest> <meta-data> <path-permission>
- Android API Guides 之 App Manifest(8) - <data>
- Android API Guides 之 App Manifest(12) - <manifest>
- Android API Guides 之 App Manifest(1) - Structure
- Android API Guides 之 App Manifest(2) - <action>
- Android API Guides 之 App Manifest(3) - <activity>
- Android API Guides 之 App Manifest(4) - <activity-alias>
- Android API Guides 之 App Manifest(5) - <application>
- Android API Guides 之 App Manifest(6) - <category>
- Android API Guides 之 App Manifest(7) - <compatible-screens>
- Android API Guides 之 App Manifest(10) - <instrumentation>
- Android API Guides 之 App Manifest(11) - <instrumentation>
- Android API Guides 之 App Manifest(14) - <path-permission>
- Android API Guides 之 App Manifest(15) - <permission>
- Android API Guides 之 App Manifest(16) - <permission-group>
- Android API Guides 之 App Manifest(17) - <permission-tree>
- Android API Guides 之 App Manifest(18) - <provider>
- Hibernate的LockMode(悲观锁和乐观锁)
- Android API Guides 之 App Manifest(12) - <manifest>
- Java轻量级业务层框架Spring两大核心IOC和AOP原理
- just so so
- HDU 1176 免费馅饼
- Android API Guides 之 App Manifest(13) - <meta-data>
- Django 1.6 在Windows平台下的配置
- 枚举类型 Java编程思想 读书笔记
- Android API Guides 之 App Manifest(14) - <path-permission>
- iReport专题学习之变量、栏05
- 线段树练习
- GNU系统下DL_POLY的编译
- ZOJ 3769 —— Diablo III(背包,DP)
- tcp实现简单的文件服务器(只能传文件)