zoukankan      html  css  js  c++  java
  • Android

      一个Manifest只能包含一个application节点。他使用各种属性来指定应用程序的各种元数据(包括标题、图标和主题),在开发应用程序时,应该宝航一个设置有true的debuggable属性以启用调试,但是在发布时可以禁用该属性

      application节点还可以作为一个包含了Activity、Service、Content Provider和Broadcast Receiver及诶单的容器,它包含的这些节点指定了应用程序组件。

    <application android:icon="@drawable/icon"

            android:logo="@drawable/logo"

            android:theme="@android:style/Theme.noTitleBar.Fullscreen"

            android:name=".MyApplicationActivity"

            android:debuggable="true"> 

    </application>

      1) Activity 应用程序内的每一个Activity都要求有一个activity标签,并使用android:name属性来指定Activity类的名称。必须包含核心的启动Activity和其它所有可以显示的Activity。启动任何一个没有在Manifest中定义的Activity时都会抛出一个运行时异常。每一个Activity节点都允许使用intent-filter子签来定义用于启动该Activity的Intent。

    在指定Activity的类名时,可以使用英文状态的“.”作为简写方式代替应用程序的包名。

      <activity android:name=".MyActivityName"

            android:label="@string/app_name">

        <intent-filter>

          <action android:name="android.intent.action.MAIN" />

          <category android:name="android.intent.category.LAUNCHER" />

        </intent-filter>

      </activity>

      2) Service和activity标签一样,需要为应用程序中使用的每一个Service类添加一个标签。Service变迁也支持使用intent-filter子签来允许运行时绑定。

      <service android:name=".MyServiceClass"></service>

      3) Provider provider标签用来指定应用程序中的每一个Content Provider。Content Provider用来管理数据库访问和共享。

      <provider android:name=".MyContentProvider"

            android:authorities="com.package.myapp.MyContentprovider"/>

      4)Receiver 通过添加receiver标签,可以注册一个Broadcast Receiver,而不用事先启动应用程序。Broadcast Receiver就像全局事件监听器一样,一旦注册了之后,无论何时,只要与它相匹配的Intent被系统或应用程序广播出来,它就会立即执行。通过在manifest中注册一个Broadcast Receiver,可以使这个进程实现完全自治。如果一个匹配的Intent被广播了,则应用程序就会自动启动,并且你注册的Broadcast Receiver也会开始运行。每个receiver节点都允许使用intent-filter子签来定义可以用来触发接收器的Intent

      <receiver android:name=".MyIntentReceiver">

        <intent-filter>

          <action android:name="com.package.mybroadcastaction"/>

        </intent-filter>

      </receiver>

      5)user-library  用于指定改应用程序需要的共享库。例如:将地图API打包为一个单独的库,它不会被自动链接。可以指定特定的一个包是必须的还是可选的。指定为必需时,在缺少指定库的设备上将无法安装应用程序;指定为可选时,应用程序在视图使用库之前,必需使用反射机制来检查该哭是否存在。

      <users-library android:name="com.google.android.maps"

              android:required-"false" />

    更多的AndroidManifest配置参考地址:http://developer.android.com/guide/topics/manifest/manifest-intro.html  (需要FQ)

    ------------------------------
    Brant Liu

    lbf1988@qq.com

    有梦想的码农
  • 相关阅读:
    Nginx Backup配置
    CANas分析软件,DBC文件解析,CAN报文分析,仿CANoe曲线显示
    MySQL 报错:MySQL Illegal mix of collations for operation 'like'
    docker部署rebbitmq
    docker部署kafka
    nodejs 环境配置
    spring是怎么运行的?
    Java发展的时间表
    单例模式(转)
    disable的错误使用
  • 原文地址:https://www.cnblogs.com/brantliu/p/4866072.html
Copyright © 2011-2022 走看看