我只是希望它在主菜单上只显示一个活动并隐藏其余活动. 我的清单文件看起来像这样. application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true" activity android:name=".
我的清单文件看起来像这样.
<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>您不需要为所有活动重复这些行;
<intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter>
只为主要的一个
(作为评论问题的广告:
来自:http://developer.android.com/guide/topics/manifest/manifest-intro.html
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.