本文编辑整理自:
http://blog.163.com/hero_213/blog/static/39891214201242835410742/
<activity-alias>是为activity创建快捷方式的,如下实例:
八、第三层<activity-alias>属性
<activity-alias
android:enabled
=
["true"
|
"false"
]
android:exported
=
["true"
|
"false"
]
android:icon
=
"drawable resource"
android:label
=
"string resource"
android:name
=
"string"
android:permission
=
"string"
android:targetActivity
=
"string"
>
<intent-filter/>
<meta-data/>
</activity-alias>
<activity android:name=".shortcut">
<intent-filter>
<action
android:name
=
"android.intent.action.MAIN"
/>
</intent-filter>
</activity>
<activity-alias
android:name
=
".CreateShortcuts"
android:targetActivity
=
".shortcut"
android:label
=
"@string/shortcut"
>
<intent-filter>
<action
android:name
=
"android.intent.action.CREATE_SHORTCUT"
/>
<category
android:name
=
"android.intent.category.DEFAULT"
/>
</intent-filter>
</activity-alias>
其中android.targetActivity是指向对应快捷方式的activity,如上述的shortcut(此Activity名)
android:label是指快捷方式的名称,而快捷方式的图标默认是给定的application图标
九、第三层<service>
<service android:enabled=["true" | "false"]
android:exported[="true" | "false"]
android:icon="drawable resource"
android:label
=
"string resource"
android:name
=
"string"
android:permission
=
"string"
android:process
=
"string"
>
</service>
关于service的更多内容请阅读《Service简介》和《AIDL和Service实现两进程通信》
十、第三层<receiver>
receiver的属性与service一样,这里就不显示了关于receiver的更多内容请阅读《BroadcastReceiver》
十一、第三层<provider>属性
<provider android:authorities="list"
android:enabled=["true" | "false"]
android:exported
=
["true"
|
"false"
]
android:grantUriPermissions
=
["true"
|
"false"
]
android:icon
=
"drawable resource"
android:initOrder
=
"integer"
android:label
=
"string resource"
android:multiprocess
=
["true"
|
"false"
]
android:name
=
"string"
android:permission
=
"string"
android:process
=
"string"
android:readPermission
=
"string"
android:syncable
=
["true"
|
"false"
]
android:writePermission
=
"string"
>
<grant-uri-permission/>
<meta-data/>
</provider>
【1】android:authorities:
标识这个ContentProvider,调用者可以根据这个标识来找到它
【2】android:grantUriPermission:
对某个URI授予的权限
【3】android:initOrder
十二、第三层<uses-library>
<uses-library
android:name
=
"string"
android:required=["true" | "false"] />
用户库,可自定义。所有android的包都可以引用。
十三、第一层<supports-screens>
<supports-screens android:smallScreens=["true" | "false"]
android:normalScreens
=
["true"
|
"false"
]
android:largeScreens
=
["true"
|
"false"
]
android:anyDensity
=
["true"
|
"false"
]
/>
这是在android1.6以后的新特性,支持多屏幕机制
各属性含义:这四个属性,是否支持大屏,是否支持中屏,是否支持小屏,是否支持多种不同密度
十三、第二层<uses-configuration />与<uses-feature>性能都差不多
这两者都是在描述应用所需要的硬件和软件特性,以便防止应用在没有这些特性的设备上安装。
<uses-configuration
android:reqFiveWayNav
=
["true"
|
"false"
]
android:reqHardKeyboard
=
["true"
|
"false"
]
android:reqKeyboardType
=
["undefined"
|
"nokeys"
|
"qwerty"
|
"twelvekey"
]
android:reqNavigation
=
["undefined"
|
"nonav"
|
"dpad"
|
"trackball"
|
"wheel"
]
android:reqTouchScreen
=
["undefined"
|
"notouch"
|
"stylus"
|
"finger"
]
/>
<uses-feature
android:glEsVersion
=
"integer"
android:name
=
"string"
android:required
=
["true"
|
"false"
]
/>
关于此的详细内容请参考
十四、第二层<uses-sdk />
<uses-sdk android:minSdkVersion="integer"
android:targetSdkVersion
=
"integer"
android:maxSdkVersion
=
"integer"
/>
描述应用所需的api level,就是版本,目前是android 2.2 = 8,android2.1 = 7,android1.6 = 4,android1.5=3
在此属性中可以指定支持的最小版本,目标版本以及最大版本
十五、第二层<instrumentation />
<instrumentation
android:functionalTest
=
["true"
|
"false"
]
android:handleProfiling
=
["true"
|
"false"
]
android:icon
=
"drawable resource"
android:label
=
"string resource"
android:name
=
"string"
android:targetPackage
=
"string"
/>
定义一些用于探测和分析应用性能等等相关的类,可以监控程序。在各个应用程序的组件之前instrumentation类被实例化
android:functionalTest(解释:instrumentation类是否能运行一个功能测试,默认为false)
十六、<permission>、<uses-permission>、<permission-tree />、<permission-group />区别~
当我们需要获取某个权限才能访问某个组件(Activity,Serivice,ContentProver)或数据时,就必须在我们的manifest文件中使用<uses-permission>来声明获得该权限。注意此<uses-permission>与<application>同级组件。
为了安全,我们可以在组件(Activity,Serivice,ContentProver)中声明别的应用程序需要某些permission才能访问它们,这样别的应用程序如果要访问这些组件的话,就需要在他们manifest文件中使用<uses-permission>来声明获得这些权限
比如:
<permission android:name="com.teleca.project.MY_SECURITY" . . . />
那么在activity中就可以声明需要这个自定义权限才能启动该Activity了,如:
<application
. . .
>
<activity
android:name
=
"XXX"
. . .
>
android:permission="com.teleca.project.MY_SECURITY">
</activity>
、
</application>
当别的应用程序需要启动你的名为“XXX”的Activity时,就需要使用<uses-permission>来声明需要获得权限
com.teleca.project.MY_SECURITY
<permission-group> 就是声明一个标签,该标签代表了一组permissions,而<permission-tree>是为一组permissions声明了一个namespace。