如何创建主屏更换应用程序?是否有关于主屏幕应用程序的信息?
只要用CATEGORY_HOME
意图注册,任何应用程序都可以成为主屏幕吗?
答案 0 :(得分:41)
可以编写自己的主屏幕应用程序。它被称为启动器。
您可以通过Git获取默认Android启动器的源代码。
项目网址为:
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。
答案 1 :(得分:29)
使您的活动成为主屏幕的特定意图是:
<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>