Launcher的简单讲解一
Launcher俗称HomeScreen,也就是我们启动Android手机,第一眼看到的应用程序,而这个应用程序是比较特殊而且任务艰巨的。
它负责了我们除了应用本身操作以外的所有操作,它负责了我们有几个桌面,点击应用图标启动应用程序,长时间按桌面出现上下文菜单,
长时间按桌面的图标出现垃圾箱,拖动应用图标重新定位等等,一系列的操作。我将截些图让大家更容易理解!

图1:开机画面,Laucher的主界面 图2:打开抽屉,列出所有我们的所安装应用

图三:长按图标,抽屉变成垃圾箱了 图四:手指向左滑动进入另一个桌面
我就先截这几个图让大家感受感受,图2中我们列出的所有应用并不包括诸如:Launcher,Widget等应用,是因为我们我们列出的应用仅仅是在AndroidManifest.xml配置文件有这样标记的应用(如下代码:)
[java]
view plain
copy<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.view"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.view.MainActivity"
android:launchMode="singleTask"
android:clearTaskOnLaunch="true"
android:stateNotNeeded="true"
android:screenOrientation="nosensor"
android:windowSoftInputMode="stateUnspecified|adjustPan"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.HOME"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</application>
</manifest>
其中<action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />是关键,有了这两句,你的应用程序才会被列出
这里第11行起了作用了,大家看出来Launcher与普通应用程序的区别了吗,变成Home的时候,当我们重新安装一个Launcher的时候,我们按一下手机的HOME键会出现Launcher列表如下图:

图5:Launcher列表 图6:传说中的Launcher2