您的位置:首页 > 移动开发 > Android开发

AndroidManifest.xml 文件详解

2015-06-14 19:44 399 查看
AndroidManifest.xml配置文件的根元素,必须包含一个<application>元素并且指定xlmns:android和package属性。

xlmns:android指定了Android的命名空间,默认情况下是“http://schemas.android.com/apk/res/android”;

而package是标准的应用包名,也是一个应用进程的默认名称。

<manifest>标签语法范例如下。

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

    package="string"

    android:sharedUserId="string"

    android:sharedUserLabel="string resource" 

    android:versionCode="integer"

    android:versionName="string"

    android:installLocation=["auto" | "internalOnly" | "preferExternal"] >

... ...

</manifest>

<application>,应用配置的根元素,位于<manifest>下层,包含所有与应用有关配置的元素,其属性可以作为子元素的默认属性,常用的属性包括:应用名android:label,应用图标android:icon,应用主题android:theme等。当然,<application>标签还提供了其他丰富的配置属性,由于篇幅原因就不列举了,

<activity>,Activity活动组件(即界面控制器组件)的声明标签,Android应用中的每一个Activity都必须在AndroidManifest.xml配置文件中声明,否则系统将不识别也不执行该Activity。<activity>标签中常用的属性有:Activity对应类名android:name,对应主题android:theme,加载模式android:launchMode(详见2.1.3.4节),键盘交互模式android:windowSoftInputMode等,其他的属性用法大家可以参考Android
SDK文档学习。另外,<activity>标签还可以包含用于消息过滤的<intent-filter>元素,当然还有可用于存储预定义数据的<meta-data>元素
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  android应用