1. 程式人生 > >AndroidManifest.xml 詳解 (一) 之——譯自《Beginning Android Games》

AndroidManifest.xml 詳解 (一) 之——譯自《Beginning Android Games》

關於android遊戲開發優秀的中文書籍實在是太少,英文的確有很多。

沒辦法,狠下心來學英語,用翻譯工具哪裡不懂點哪裡!

為了提高我的英語水平和記憶強度,我把書上的一些我覺得比較有用的片發到上面,翻譯的不好,勿噴

先來點簡單的:

AndroidManifest.xml 之 <manifest> 元素

<manifest> 標籤是AndroidManifest.xml 的根節點,這有一個基本的例子:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.helloworld"
      android:versionCode="1"
      android:versionName="1.0"
      android:installLocation="preferExternal"> 
...
</manifest>

可能以前你用過XML, 可能對於第一行已經很熟悉了,<manifest>標籤指定了一個我們可以在其他 manifest 檔案都可以看到的android 名稱空間。

package屬性定義了我們應用中的root包。 在將來我們會建立各種類到相對於這個包名的包中。

versionCode 和 versionName 屬性 指定了我們的應用版本的兩種形式。

versionCode是一個整數,我們必須在每個更新版本釋出的時候加1,這樣Android Market才能追蹤到應用版本。

versionName是使用者可見的版本號,可以是任意字串(比如說1.0, 2.0...)

installLocation 屬性用來制定應用在SD卡上的安裝的路徑(只有在android2.2版本及以上有用),如果有可能儘量把andorid2.2及以上的應用安裝在內部儲存裝置中。

在manifest裡面所有的元素屬性通常都以android作為字首

在<manifest>元素裡面,定義了應用的元件,許可權,硬體配置和支援的android版本。

下面一個元素是<application>。今天先到這裡~

附上原文:

The <manifest> Element
The <manifest> tag is the root element of an AndroidManifest.xml file. Here’s a basic
example:
<manifest xmlns:android="
http://schemas.android.com/apk/res/android

"
      package="com.helloworld"
      android:versionCode="1"
      android:versionName="1.0"
      android:installLocation="preferExternal"> 
...
</manifest>


Assuming you have worked with XML before, you should be familiar with the first line.
The <manifest> tag specifies a namespace called android, which is used throughout the
rest of the manifest file. The package attribute defines the root package name of our
application. Later on, we’ll reference specific classes of our application relative to this
package name. 


The versionCode and versionName attributes specify the version of our application in two
forms. The versionCode is an integer we have to increment each time we publish a new
version of our application. It is used by the Android Market to track our application’s
version. The versionName is displayed to users of the Android Market when they
browses our application. We can use any string we like here. 

 
The installLocation attribute is only available to us if we set the build target of our
Android project in Eclipse to Android 2.2 or newer. It specifies where our application
should be installed. The string preferExternal tells the system that we’d like our
application to be installed to the SD card. This will only work on Android 2.2 or newer,
and is ignored by all earlier Android applications. On Android 2.2 or newer the
application will always get installed to the internal storage if possible.


All attributes of the XML elements in a manifest file are generally prefixed with the
android namespace, as shown previously. For brevity, I will not specify the namespace
in the following sections when talking about a specific attribute. 
Inside the <manifest> element, we then define the application’s components,
permissions, hardware profiles, and supported Android versions.

相關推薦

AndroidManifest.xml () ——Beginning Android Games

關於android遊戲開發優秀的中文書籍實在是太少,英文的確有很多。 沒辦法,狠下心來學英語,用翻譯工具哪裡不懂點哪裡! 為了提高我的英語水平和記憶強度,我把書上的一些我覺得比較有用的片發到上面,翻譯的不好,勿噴 先來點簡單的: AndroidManifest.xml

AndroidManifest.xml (二) ——Beginning Android Games》 .

    To reference resources, we use the preceding notation. The @ specifies that we want to reference a resource defined elsewhere. The following string ide

AndroidManifest.xml (六) uses-sdk—— Beginning Android Games

   我們要寫入manifest檔案的最後一個元素就是<uses-sdk>。它是<manifest>的子元素。在第二章建立Hello World專案的時候,在New Android Project對話方塊中,通過指定Android SDK 的最小版

AndroidManifest.xml (五) uses-feature—— Beginning Android Games

Another useful thing for game developers is to specify which OpenGL ES version is needed. Now, in this book we’ll be concerned with OpenGL ES 1.0 and 1.1.

XMLXML語法

XML指可擴充套件標記語言很類似 HTML,被設計用來傳輸和儲存資料而非顯示資料,XML標籤沒有被預定義需要自行定義標籤,標籤具有自我描述性,同時XML也是 W3C 的推薦標準。 先來寫一個XML指令碼demo.xml: <?xml version="1.0" encoding="U

docker系列<>docker安裝

1、Docker 要求 CentOS 系統的核心版本高於 3.10 ,檢視本頁面的前提條件來驗證你的CentOS 版本是否支援 Docker 。 通過 uname -r 命令檢視你當前的核心版本 $ uname -r 2、使用 root 許可權登入 Centos。確保 yum 包更新到最新。 $ su

NTFS檔案系統()硬碟基本資訊

本文參考自部落格 一般硬碟正面貼有產品標籤,主要包括廠家資訊和產品資訊,如商標、型號、序列號、生產日期、容量、引數和主從設定方法等。這些資訊是正確使用硬碟的基本依據,下面將逐步介紹它們的含義。 硬碟主要由盤體、控制電路板和介面部件等組成,如圖1-1所示。

[轉載]AndroidAndroidManifest.xml

一、關於AndroidManifest.xml AndroidManifest.xml 是每個android程式中必須的檔案。它位於整個專案的根目錄,描述了package中暴露的元件(activities, services, 等等),他們各自的實現類,各種能被處理的資料和

AndroidManifest.xml

目錄 一、AndroidManifest.xml整體結構

OpenLayers官方示例定義canvas元素上渲染OpenLayers的幾何圖形(Render geometries to a canvas)

目錄 一、示例簡介 二、程式碼詳解 一、示例簡介     這個示例展示瞭如何將OpenLayers的幾何圖形渲染到任意的canvas元素上。 二、程式碼詳解     ol.render.toContext()方法能夠將任意ca

安卓開發——AndroidManifest.xml配置

AndroidManifest.xml配置檔案稱為清單檔案,對於Android應用開發來說是非常重要的基礎知識,在學習中總結該配置檔案中重點的用法,以便日後查閱。下面是一個標準的AndroidManifest.xml檔案樣例。 xml version="1.0" encod

定義轉場()

assign pda 好的 led hint ext hid case delegate 前言 本文是我學習了onevcat的這篇轉場入門做的一點筆記。 今天我們來實現一個簡單的自定義轉場,我們先來看看這篇文章將要實現的一個效果圖吧: 過程詳解 熱身準備 我們先創建一

Java8新特性Stream

寫了Lambda表示式的部落格,怎麼能少了對Stream的學習呢!接下來就將我所理解的Stream分享給大家,歡迎指出不足之處... 一、為什麼要使用Stream?Stream是什麼?在Java中該怎麼用呢?        (1)為什麼要使用Str

pythoncelery使用

前段時間需要使用rabbitmq做寫快取,一直使用pika+rabbitmq的組合,pika這個模組雖然可以很直觀地操作rabbitmq,但是官方給的例子太簡單,對其底層原理了解又不是很深,遇到很多坑,尤其是需要自己寫連線池管理和channel池管理。雖然也有用過celery,一直也是celery+redis

Struts2框架struts.xml

Struts2框架之struts.xml詳解 文章目錄 Struts2框架之struts.xml詳解 一個struts.xml的配置示例 package標籤的配置 action標籤的配置 result標

Antbuild.xml

Ant的概念 可能有些讀者並不連線什麼是Ant以及入可使用它,但只要使用通過Linux系統得讀者,應該知道make這個命令。當編譯Linux核心及一些軟體的源程式時,經常要用這個命令。Make命令其實就是一個專案管理工具,而Ant所實現功能與此類似。像make,gnumake

死磕Netty原始碼記憶體分配()(PooledByteBufAllocator)

前言 為了避免頻繁的記憶體分配給系統帶來負擔以及GC對系統性能帶來波動,Netty4使用了記憶體池來管理記憶體的分配和回收,Netty記憶體池參考了Slab分配和Buddy分配思想。Slab分配是將記憶體分割成大小不等的記憶體塊,在使用者執行緒請求時根據請求的

死磕Netty原始碼Reactor執行緒模型()NioEventLoop的啟動

前言 Netty中最核心的就是Reactor執行緒,對應Netty中的程式碼就是NioEventLoop。NioEventLoop是通過NioEventLoopGroup進行維護的,所以在介紹NioEventLoop前我們先介紹一下NioEventLoopGr

C#詞法分析器詞法分析的使用()

雖然文章的標題是詞法分析,但首先還是要從編譯原理說開來。編譯原理應該很多人都聽說過,雖然不一定會有多麼瞭解。 簡單的說,編譯原理就是研究如何進行編譯——也就如何從程式碼(*.cs 檔案)轉換為計算機可以執行的程式(*.exe 檔案)。當然也有些語言如 JavaScrip

Antbuild.xml(有例項)

Ant的概念  可能有些讀者並不連線什麼是Ant以及入可使用它,但只要使用通過Linux系統得讀者,應該知道make這個命令。當編譯Linux核心及一些軟體的源程式時,經常要用這個命令。Make命令其實就是一個專案管理工具,而Ant所實現功能與此類似。像make,gnumake和nmake這些編譯工具都有一