【发布时间】:2011-04-09 16:02:20
【问题描述】:
如何创建主屏幕替换应用程序?有关于主屏幕应用程序的任何信息吗?
任何应用程序都可以通过CATEGORY_HOME 意图注册成为主屏幕吗?
【问题讨论】:
标签: android launcher homescreen
如何创建主屏幕替换应用程序?有关于主屏幕应用程序的任何信息吗?
任何应用程序都可以通过CATEGORY_HOME 意图注册成为主屏幕吗?
【问题讨论】:
标签: android launcher homescreen
编写您自己的主屏幕应用程序是可能的。它被称为启动器。
您可以通过Git获取默认Android Launcher的源代码。
项目网址是:
https://android.googlesource.com/platform/packages/apps/Launcher2.git
你可以这样获取源代码:
git clone https://android.googlesource.com/platform/packages/apps/Launcher2.git
这将为您创建一个名为 Launcher2 的目录。现在您可以开始破解并创建您的自定义启动器了。
如果您在使用 Git 方面需要帮助,请查看 Git 的documentation section。
【讨论】:
使您的活动成为主屏幕的具体意图是:
<activity....>
<!-- Put this filter inside the activity to make it the Home screen -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
【讨论】: