標籤:
AndroidManifest.xml
本質:是整個應用的主配置資訊清單檔
包含:該應用的包名,版本號碼,組件,許可權等資訊
作用:記錄該應用的相關的配置資訊
一、常用標籤
(1)、全域篇(包名,版本資訊)
(2)、組件篇(四大組件)、
(3)、許可權篇(申請許可權和定義許可權)
1、全域篇
(1)、應用的包名以及版本資訊的管理
package="com.example.tset"
android:versionCode="1"
android:versionName="1.0">
(2)、控制android版本的資訊(可以支援的最低版本,你期望的系統版本)
android:minSdkVersion="8"
android:targetSdkVersion="16"
2、組件篇
<application android:icon="@drawable/icon"
android:theme="@style/my_theme">
</application>
其屬性可以設定:
(1)、表徵圖:android:icon
(2)、標題:android;label
(3)、主題樣式:android:theme
在設定檔中註冊組件
(1)、定義Activity
<activity
android:name="com.example.allcode.MainActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Dialog"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" /> //作為主activity
<category android:name="android.intent.category.LAUNCHER" /> //顯示在軟體列表中
</intent-filter>
</activity>
註:啟動一個沒有在清單中定義的Activity會拋出異常
(2)、定義Service(服務)
<sevice android:name="com.ttg.service.CouponService"
<intent-filter>
<action android:name="com.ttg.service"</action>
</intent-filter>
</seivice>
(3)、Content Provider(內容提供者)
<provider android:name="com.example.manifest.provider">
</provider>
內容提供者用來管理資料庫訪問及程式內和程式間共用的
(4)、Broadcast Receiver(廣播接收者)
<receiver android:name="com.ttg.receiver.CouponService"
<intent-filter>
<action android:name="com.ttg.install"</action>
</intent-filter>
</receiver>
安卓開發_淺談主設定檔(AndroidManifest.xml)