两个快捷方式与同一个应用程序的两个图标 [英] Two shortcut with Two Icons for the same App

查看:444
本文介绍了两个快捷方式与同一个应用程序的两个图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我希望为同一个应用程序添加一个额外的快捷方式,另一个快捷方式,应用程序抽屉中的可见,应该启动一个简单的活动/服务,

So , i want to have an additional Shortcut with another Icon for the same App , this additional Shortcut , Visible in App Drawer , should launch a Simple Activity/Service ,

这是可能的,如果是的话怎么样?如果可能,以编程方式,

it is Possible , If yes How ? If Possible , Programmaticly ,

与<应用>标签? ,

Does its matter with < application > Tag ? ,

谢谢

推荐答案

当然你可以有两个或更多应用程序中的启动器活动。只需使用启动属性设置一个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

这篇关于两个快捷方式与同一个应用程序的两个图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆