如何为Android创建自定义主屏替换应用程序?

Sim*_*mon 49 android launcher homescreen

如何创建主屏替换应用程序?有关于主屏幕应用程序的信息吗?

任何应用程序都可以通过注册CATEGORY_HOME意图来成为主屏幕吗?

Oct*_*ean 41

可以编写自己的主屏幕应用程序.它被称为启动器.

您可以通过Git获取默认Android Launcher的源代码.

项目URL是:

https://android.googlesource.com/platform/packages/apps/Launcher2.git

你可以得到这样的源代码:

git clone https://android.googlesource.com/platform/packages/apps/Launcher2.git
Run Code Online (Sandbox Code Playgroud)

这将为您创建一个名为Launcher2的目录.现在您可以破解并创建自定义启动器.

如果您在使用Git时需要帮助,请查看Git的文档部分.

  • 不要忘记查看ADW Launcher的源代码:http://code.google.com/p/adw-launcher-android/ (18认同)

Ena*_*Ena 32

使您的活动成为主屏幕的特定意图是:

<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>
Run Code Online (Sandbox Code Playgroud)