且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

两个快捷方式与同一个应用程序的两个图标

更新时间:2023-11-22 16:52:52

当然你可以有两个或更多应用程序中的启动器活动。只需使用启动属性设置一个intent过滤器。

Of course you can have two or more launcher activities in your application. Just set an intent filter with launch attributes.

<activity
    android:name=".SecondActivity"
    android:icon="@drawable/ic_second_launcher">
    <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
    </intent-filter>
</activity>

如果你想从AppDrawer启动服务,只需调用一个空的 Activty onCreate

If you want to start a service from the AppDrawer, just call an empty Activty which starts the Service in onCreate