简体   繁体   English

没有启动器图标

[英]No launcher icon

I have an interesting problem - at least for me. 我有一个有趣的问题 - 至少对我而言。 I don't want my application to have a launcher icon in the menu - I start it remotely and I don't want to show it up in the menu. 我不希望我的应用程序在菜单中有一个启动器图标 - 我远程启动它,我不想在菜单中显示它。

How can I solve that? 我怎么解决这个问题?

My idea is deleting the following from the manifest: 我的想法是从清单中删除以下内容:

<intent-filter>
     <action android:name="android.intent.action.MAIN" />
     <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

Would this solve my problem? 这会解决我的问题吗?

Delete that: 删除:

 <category android:name="android.intent.category.LAUNCHER" />

And you won't have a launcher icon. 你不会有一个启动器图标。

That's what i would do. 这就是我要做的。 This defines the gateway activity to your application and doesn't affect the functionality. 这将定义应用程序的网关活动,但不会影响功能。 If no activity has this filter, there won't be an icon to launch it manually, precisely what you want. 如果此过滤器没有活动,则不会有手动启动它的图标,正是您想要的。

https://stackoverflow.com/a/13552763/6481542 is correct, but to address the Android Studio compilation issue noted in the comments, you need to modify the Run Configuration in Android Studio: https://stackoverflow.com/a/13552763/6481542是正确的,但要解决评论中提到的Android Studio编译问题,您需要修改Android Studio中的运行配置:

  • Go to Run -> Edit Configurations 转到“运行” - >“编辑配置”
  • Under Launch Options, change Launch from Default Activity to any of the other options. 在“启动选项”下,将“从Default Activity启动”更改为任何其他选项。 Using Specified Activity with one of your activities is a suitable approach. 在某项活动中使用“ Specified Activity活动”是一种合适的方法。

This works with Android Studio 2.2.3. 这适用于Android Studio 2.2.3。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM