当前位置:首页 > Android Launcher研究
应用中唯一一个Activity是这样申明的,如下代码:
view plaincopy to clipboardprint?
? ?? android:name=\ ?? android:launchMode=\ ?? android:clearTaskOnLaunch=\ ?? android:stateNotNeeded=\ ?? android:theme=\ ?? android:screenOrientation=\ ?? android:windowSoftInputMode=\> ?? ??
这里第11行起了作用了,大家看出来Launcher与普通应用程序的区别了吗,变成Home的时候,当我们重新安装一个Launcher的时候,我们按一下手机的HOME键会出现Launcher列表如下图:
图5:Launcher列表 图6:传说中的Launcher2
Ok,今天就先说到这里,大家有什么不明白的请留言!我一定尽量准时答复.谢谢~ 三、列出所安装的应用,点击进入相应的应用!
大家好,我今天给大家简单讲一下Launcher里如何列出所有安装的应用的,我们点击Launcher的抽屉(SlidingDrawer)就会出现所有安装的应用列表(当然Widget,Launcher本身除外).并且点击应用图标进入 相关应用。我这里就先简单的用一个GridView来显示应用。 老样子我还会写一个简单的Demo让大家理解。大家跟着我的步骤来。 第一步:新建一个Android工程命名为:Launcher.
第二步:修改main.xml布局文件,代码如下(只有一个GridView这里):
view plaincopy to clipboardprint?
? ? ?
? ? ? ? ? ? android:layout_width=\ android:layout_height=\ > android:id=\ android:layout_width=\ ?? android:layout_height=\ ?? /> ??
第三步:新建一个application_layout.xml布局文件,用来定义应用的图标和标题,代码如下:
view plaincopy to clipboardprint?
??
??
?? ?? android:id=\ ?? android:layout_width=\ ?? android:layout_height=\ ?? /> ?? ?? android:id=\ ?? android:layout_width=\ ?? android:layout_height=\ ?? /> ?? 第四步:也就是核心了,修改Launcher.java代码如下: view plaincopy to clipboardprint? ?? package com.tutor.launcher; ?? import java.util.Collections; ?? import java.util.List; ?? import android.app.Activity; ?? import android.content.ComponentName; ?? import android.content.Context; ?? import android.content.Intent;
共分享92篇相关文档