下面内容参考:Beginning Android 4 Application Development Page31.
第一梯队, 在最外面.
<manifest>
<activity>
<activity-alias>
<service>
<receiver>
<provider>
<uses-library>
第二梯队, 在 <application> 内部.
<application>
<intent-filter>
<meta-data>
activity - theme:
<activity android:theme="@android:style/Theme.Dialog"> //对话框形式 <activity android:theme="@android:style/Theme.Translucent"> //透明形式
activity - screenOrientation:
<android:screenOrientation="landscape"> //强制水平显示 <android:screenOrientation="portrait"> //强制竖直显示
包括以下值:"unspecified" | "user" | "behind" | "landscape" | "portrait" | "reverseLandscape" | "reversePortrait" | "sensorLandscape" | "sensorPortrait" | "sensor" | "fullSensor" | "nosensor".
activity - windowSoftInputMode:
<android:windowSoftInputMode="stateHidden"> //即使默认文本框获取焦点, 但是不会立即弹出输入法面板
包括以下值:"stateUnspecified", "stateUnchanged", "stateHidden", "stateAlwaysHidden", "stateVisible", "stateAlwaysVisible", "adjustUnspecified", "adjustResize", "adjustPan".
第三梯队, 在 <activity> 内部.
<activity>
<activity-alias>
<service>
<receiver>
<action>
<category>
<data>
第四阶梯, 在 <intent-filter> 内部.
<intent-filter>
<actionandroid:name="com.example.project.TRANSMOGRIFY"/>
第四阶梯, 在 <intent-filter> 内部.
<intent-filter>
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.LAUNCHER" />
举个例子:
<activity android:label=” Second Activity” android:name=”.SecondActivity” > <intent-filter > <action android:name=”net.learn2develop.SecondActivity” /> <category android:name=”android.intent.category.DEFAULT” /> </intent-filter> </activity>
The category for the intent filter is android.intent.category.DEFAULT. You need to add this to
the intent filter so that this activity can be started by another activity using the startActivity()
method (more on this shortly).
public void onClick(View view) { startActivity(new Intent(“net.learn2develop.SecondActivity”)); }
第一阶梯, 用来提供许可的, 只有提供了许可才可以使用手机的一些功能.
<manifest>
举个例子:
<uses-permission android:name="android.permission.CALL_PHONE"/> //打电话 <uses-permission android:name="android.permission.SEND_SMS"/> //发短信 <uses-permission android:name="android.permission.INTERNET"/> //上网 <uses-permission android:name="android.permission.VIBRATE"/> //通知
常量值属于 Manifest.permission 类.
android.intent.category