AndroidManifest.xml以及manifest節點

來源:互聯網
上載者:User

標籤:android   style   blog   http   io   color   ar   使用   sp   

參考資料:
http://developer.android.com/guide/topics/manifest/manifest-intro.html
http://developer.android.com/guide/topics/manifest/manifest-element.html

每個Android應用程式工程根目錄必須有一個AndroidManifest.xml檔案。這個檔案包含著應用程式在Android系統中的配置資訊。在程式被安裝時這些資訊會被系統讀取,並被合理的安裝。
這些資訊包括:
應用程式基底本資訊,包括包名,版本號碼等
應用程式內使用的組件聲明,配置資訊
應用程式需要的sdk版本,功能,許可權,庫
應用程式發布的許可權

樣本:

<?xml version="1.0" encoding="utf-8"?><manifest>   <uses-permission/>    <permission/>    <permission-tree/>    <permission-group/>    <instrumentation/>    <uses-sdk/>    <uses-configuration/>    <uses-feature/>    <supports-screens/>    <compatible-screens/>    <supports-gl-texture/>    <application>     <activity>       <intent-filter>         <action/>          <category/>          <data/>       </intent-filter>        <meta-data/>     </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/>        <path-permission/>     </provider>      <uses-library/>   </application> </manifest>

 

manifest標籤是AndroidManifest.xml檔案的根節點。文法:

<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>

 

屬性:

xmlns:android
命名空間,固定為http://schemas.android.com/apk/res/android

 

package
應用程式套件組合名。應用程式在系統中唯一標示符,一般是com.google.example這樣的形式,包名和自動產生的資源套件名有關係,但是和自己建立的Activity等包名沒啥關係

 

android:sharedUserId
用於和別的應用程式共用的Linux使用者ID,這樣A就能訪問B的檔案,B也能訪問A的檔案。他們也能跑在一個進程中。注意:多個應用程式需要使用同樣的簽名。

 

android:sharedUserLabel
代表sharedUserId的文字標識。只有android:sharedUserId有效時才有效,必須是字串資源。

 

android:versionCode
應用程式版本號碼

 

android:versionName
應用程式版本名,給使用者看的

 

android:installLocation
應用程式預設安裝位置

可能值:
auto:預設會裝在內部儲存,如果內部儲存滿了會裝外部儲存。
internalOnly:只能裝在內部儲存中,如果內部儲存滿了不能安裝(預設值)
preferExternal:優先安裝到外部儲存,如果外部儲存不可用,則安裝到內部儲存
注意:外部儲存不穩定,插上電腦之類的都會導致不可用。

AndroidManifest.xml以及manifest節點

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.