为什么在模拟器菜单按钮显示我的应用程序的所有活动? [英] why does the menu button in the emulator show all the activities of my app?
问题描述
我只是想让它显示只有一个活动的主菜单上并隐藏其余的。
i just want it to show only one activity on the main menu and hide the remaining ones.
我的清单文件看起来是这样的。
My manifest file looks something like this.
<application android:icon="@drawable/icon" android:label="@string/app_name"
android:debuggable="true">
<activity android:name=".MainAct" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".StartGame" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Instructions" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".About" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
推荐答案
您不必为所有活动重复这些行;
You don't need to repeat these lines for all activities;
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
只为一主一
(为广告到您的评论的问题:
(as an ad-on to your comments question:
从:<一href="http://developer.android.com/guide/topics/manifest/manifest-intro.html">http://developer.android.com/guide/topics/manifest/manifest-intro.html
有意向的图标和标签集 过滤器被用来重新present一个 部件每当所述部件是 presented给用户作为满足 由过滤器通告的功能。 例如,一个过滤器 android.intent.action.MAIN和 android.intent.category.LAUNCHER 设置发布活动为一体 发起的应用程序 - 即 是,作为一个应该显示在 应用程序启动。图标和 因此,标签在过滤器中设置的 显示在发射器的人。
The icon and label set for an intent filter are used to represent a component whenever the component is presented to the user as fulfilling the function advertised by the filter. For example, a filter with "android.intent.action.MAIN" and "android.intent.category.LAUNCHER" settings advertises an activity as one that initiates an application — that is, as one that should be displayed in the application launcher. The icon and label set in the filter are therefore the ones displayed in the launcher.
这篇关于为什么在模拟器菜单按钮显示我的应用程序的所有活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!