`
weiweirenhong
  • 浏览: 32719 次
  • 性别: Icon_minigender_1
  • 来自: 西安
最近访客 更多访客>>
社区版块
存档分类
最新评论

Application Fundamentals--The manifest file

阅读更多
The manifest file

Android启动应用程序组件之前,首先必须知道被启动的应用中都有哪些组件.所以应用程序需要在manifest文件中声明该应用都绑定了什么组件, 在应用程序对应的.apk文件中同时也包含了应用程序代码、文件以及相关的资源。

manifest是一个 XML 文件,总是被命名为AndroidManifest.xml,其中,并非仅仅是声明组件,同时该文件中还可能指定该应用所需的类库以及该应用希望被授权的许可。

但是该文件的最主要作用是告知Android系统该应用所关联的组件信息例如:一个activity可以用下面的方式在AndroidManifest.xml中被声明:

<?xml version="1.0" encoding="utf-8"?>
<manifest . . . >
    <application . . . >
        <activity android:name="com.example.project.FreneticActivity"
                  android:icon="@drawable/small_pic.png"
                  android:label="@string/freneticLabel"
                  . . .  >
        </activity>
        . . .
    </application>
</manifest>

其中,activity元素的 name 属性声明了该activity类的实现类,icon 属性和 label 属性指定了 该应用所关联的资源文件中约定的icon 和 label信息.

其他组件的声明和以上类似 — <service> 元素用来声明 services组件, <receiver> 元素用来声明 broadcast receivers组件, <provider> 元素用来声明 content providers组件. 没有在AndroidManifest.xml文件中声明的Activities, services, 和 content providers 组件对于系统来说是不可见的,不会被运行的。但是, broadcast receivers是个特例,它可以在AndroidManifest.xml文件中声明也可以以代码方式动态创建 (as BroadcastReceiver objects) 然后通过 Context.registerReceiver()方法注册到Android系统中.

For more on how to structure a manifest file for your application, see The AndroidManifest.xml File.
分享到:
评论

相关推荐

    Professional Android 4 Application Development 源代码

    Introducing the Application Manifest File Using the Manifest Editor Externalizing Resources The Android Application Lifecycle Understanding an Application's Priority and Its Process' States ...

    The Art of Assembly Language Programming

    Some Final Comments on the MOV Instructions &lt;br&gt;4.9 Laboratory Exercises 4.9.1 The UCR Standard Library for 80x86 Assembly Language Programmers 4.9.2 Editing Your Source Files 4.9.3 The ...

    Android开发指南中文版-----应用程序框架

    应用程序基础Application Fundamentals 4 关键类 4 应用程序组件 5 激活组件:intent 7 关闭组件 7 manifest文件 8 Intent过滤器 8 Activity和任务 10 Affinity(吸引力)和新任务 11 加载模式 12 清理堆栈 13 启动...

    Android开发宝典.rar

    应用程序基础Application Fundamentals 4 关键类 4 应用程序组件 5 激活组件:intent 7 关闭组件 7 manifest文件 8 Intent过滤器 8 Activity和任务 10 Affinity(吸引力)和新任务 11 加载模式 12 清理...

    Android开发指南中文版

    应用程序基础Application Fundamentals 4 关键类 4 应用程序组件 5 激活组件:intent 7 关闭组件 7 manifest文件 8 Intent过滤器 8 Activity和任务 10 Affinity(吸引力)和新任务 11 加载模式 12 清理堆栈 13 启动...

    VB.NET Developer's Guide(4574).pdf

    Fundamentals 171 Introduction 172 Variables 173 Constants 175 Structures 176 Program Flow Control 178 If…Then…Else 178 Select Case 182 While Loops 184 For Loops 186 Arrays 187 Declaring ...

    Android开发指南中文版.pdf 清晰版

    应用程序基础Application Fundamentals................................ 4 关键类................................................................ 4 应用程序组件...............................................

Global site tag (gtag.js) - Google Analytics