当前位置:编程学习 > XML/UML >>

Android之 AndroidManifest.xml 文件解析

一、关于AndroidManifest.xml

AndroidManifest.xml 是每个android程序中必须的文件。它位于整个项目的根目录,描述了package中暴露的组件(activities, services, 等等),他们各自的实现类,各种能被处理的数据和启动位置。 除了能声明程序中的Activities, ContentProviders, Services, 和Intent Receivers,还能指定permissions和instrumentation(安全控制和测试)

 \
 


二、AndroidManifest.xml结构


[html]
<SPAN style="BACKGROUND-COLOR: rgb(255,255,255)"><SPAN style="FONT-SIZE: 18px"><STRONG><?xmlversionxmlversion="1.0"encoding="utf-8"?> 
 
<manifest> 
 
    <application> 
 
       <activity> 
 
           <intent-filter> 
 
               <action/> 
 
               <category/> 
 
           </intent-filter> 
 
      </activity> 
 
       <activity-alias> 
 
           <intent-filter></intent-filter> 
 
           <meta-data/> 
 
      </activity-alias> 
 
       <service> 
 
           <intent-filter></intent-filter> 
 
           <meta-data/> 
 
       </service> 
 
       <receiver> 
 
           <intent-filter></intent-filter> 
 
           <meta-data/> 
 
       </receiver> 
 
       <provider> 
 
           <grant-uri-permission/> 
 
           <meta-data/> 
 
       </provider> 
 
       <uses-library/> 
 
    </application> 
 
    <uses-permission/> 
 
    <permission/> 
 
    <permission-tree/> 
 
    <permission-group/> 
 
    <instrumentation/> 
 
    <uses-sdk/> 
 
    <uses-configuration/>  
 
    <uses-feature/>  
 
    <supports-screens/> 
 
</manifest></STRONG></SPAN></SPAN> 

<?xmlversion="1.0"encoding="utf-8"?>

<manifest>

    <application>

       <activity>

           <intent-filter>

               <action/>

               <category/>

           </intent-filter>

      </activity>

       <activity-alias>

           <intent-filter></intent-filter>

           <meta-data/>

      </activity-alias>

       <service>

           <intent-filter></intent-filter>

           <meta-data/>

       </service>

       <receiver>

           <intent-filter></intent-filter>

           <meta-data/>

       </receiver>

       <provider>

           <grant-uri-permission/>

           <meta-data/>

       </provider>

       <uses-library/>

    </application>

    <uses-permission/>

    <permission/>

    <permission-tree/>

    <permission-group/>

    <instrumentation/>

    <uses-sdk/>

    <uses-configuration/>

    <uses-feature/>

    <supports-screens/>

</manifest>


三、各个节点的详细介绍

 上面就是整个am(androidManifest).xml的结构,下面以外向内开始阐述~~

1、第一层(<Manifest>):(属性)


[html]
<manifest  xmlns:android="http://schemas.android.com/apk/res/android" 
          package="com.woody.test" 
          android:sharedUserId="string" 
          android:sharedUserLabel="string resource" 
          android:versionCode="integer" 
          android:versionName="string" 
          android:installLocation=["auto" | "internalOnly" | "preferExternal"] > 
</manifest> 

<manifest  xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.woody.test"
          android:sharedUserId="string"
          android:sharedUserLabel="string resource"
          android:versionCode="integer"
          android:versionName

补充:移动开发 , Android ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,