Android 应用程序开发:创建两个图标,我只需要一个
我正在编写一个 Android 应用程序,它有一个主要活动和一个子活动。当我在手机上安装该应用程序进行测试时,我看到了两个图标,而不是一个。第一个图标用于主活动,第二个图标用于子活动。我不想要/不需要子活动的图标。
有谁知道如何在我的应用程序代码中关闭此功能,以便仅安装主要活动的图标?非常感谢您提供的任何信息!
谢谢, 移动知道
I am writing an Android App that has one main activity and one subactivity. When I install the app on my phone to test it out, I get two icons instead of one. The first icon is for the main activity and the second is for the subactivity. I don't want/need an icon for the subactivity.
Does anyone know how to turn this off in my app code, so that only the icon for the main activity is installed? Any information you can provide is greatly appreciated!
Thanks,
MobiKnow
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
您的应用程序清单是否在与主启动器匹配的子活动下列出了意图过滤器?
确保您的子活动不会过滤这些意图。
编辑:为了非常清楚,请确保以上行未在您的子活动下列出。该意图过滤器让 Android 系统知道您打算将其列为应用程序的入口点。
Does your application manifest list an intent filter under your sub-activity that matches the main launcher?
Make sure that your sub-activity is not filtering for these intents.
Edit: Just to be very clear, make sure the above lines are not listed under your sub-activity. That intent filter lets the Android system know that you intend for it to be listed as an entry point to your application.
我们有同样的问题,但我这样解决了
在清单中下面的代码之前
请注意,在意向内的 SplashActivity 中,
我只删除了该类别
因此,在我删除启动中的意向过滤器类别后,它没有安装两个应用程序图标,但只有一个用于主代码,代码将是像这样注意到意图过滤器类别被删除
它确实有帮助
We have the same problem but i fixed it this way
before my code below in manifest
Notice that in the SplashActivity inside the intent is this code
i only deleted the category
So after i deleted the intent-filter category in splash it didn't install two app icon but only one for main the code will be like this notice that the intent-filter category is deleted
it really helps
从另一条语句中删除上述语句。那么你就可以开始了。
Remove the above statement from the other one. Then you are good to go.
就像其他答案一样,
原来是罪魁祸首。然而,在我的清单中,我只有一项具有该意图过滤器的活动。事实证明,我正在使用我构建的库,它在其清单中声明了一个使用该意图过滤器的活动。因此,简而言之,请确保您的应用程序的清单和依赖项(如果有)只有一个具有意图过滤器的活动。
Like in the other answers,
Was the culprit. However, in my manifest I only had one activity with that intent filter. As it turns out, I am using a library I built and it has an activity declared in it's manifest which uses that intent filter. So, in short, be sure your app's manifest and dependencies, if any, only have one activity with the intent filter.
我猜想在您的 AndroidManifest.xml 中,您的两个活动都具有 LAUNCHER 意图过滤器。将其从第二个活动中删除,您应该就可以了!
I guess that in your AndroidManifest.xml, you've got both activities having the LAUNCHER intent-filter. Remove it from the second activity, and you should be set!
您已准备
好
这两项活动的套装。
这意味着这是一个启动器图标,将我放在主屏幕上。仅在主屏幕上设置您想要的活动。
You have
along with
set for both activities.
What that means is that this is a launcher icon, put me on the home screen. Only set those for the activit(ies/y) you want on the home screen.
我正在寻找完全相同问题的答案。看来唯一需要的事情(除了关于删除 MAIN 和 LAUNCHER 意图过滤器的建议之外)是重建您的项目 - 这将清理一切,并且在下次启动时我在我的设备上看到了单个图标(在更改完成后仅在设备上运行应用程序)没有帮助)。
I was searching answer to exactly the same question. It appears the only thing needed (in addition to recommendations on removing MAIN and LAUNCHER intent filter) is to rebuild your project - that will clean things up and upon next launch I saw single icon on my device (just running application on device after changes did not help).
如果有人使用 Pebble SDK 遇到这个问题。我注意到 PebbleKit Androidmanifest.xml 也包含 LAUNCHER 活动。这就是我造成这种情况的原因。只需删除这部分即可。它不会影响 Pebble 功能。
if anyone run into this issue using Pebble SDK. I noticed PebbleKit Androidmanifest.xml holds a LAUNCHER activity as well. This is what caused it for me. Just remove this part. It will not effect Pebble functionality.
简单的答案..
删除:
从 AndroidManifest.xml 中
保留您的意图过滤器。
SIMPLE answer..
REMOVE:
From your AndroidManifest.xml
Leave your intent-filter alone.
为父组件设置优先级。此设置可以帮助您为 Android 应用程序开发设置父图标。
Priorities are set for the parent component. This setting may help you to set the parent icon for your Android app development.