尝试使用活动别名为我的应用程序使用多个图标。这是我的清单代码:
<activity
android:name=".splashscreen.SplashScreen"
android:launchMode="singleTask"
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-alias
android:name="com.sharesmile.share.splashscreen.SplashScreenmain"
android:targetActivity=".splashscreen.SplashScreen"
android:label="test"
android:icon="@mipmap/ic_launcher"
android:enabled="false"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias
android:name="com.sharesmile.share.splashscreen.SplashScreenpinkathon"
android:targetActivity=".splashscreen.SplashScreen"
android:label="testpinkathon"
android:icon="@mipmap/ic_launcher_pink"
android:enabled="true"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
这是我在 oncreate 启动画面活动中的代码:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getPackageManager().setComponentEnabledSetting(
new ComponentName("com.sharesmile.share", "com.sharesmile.share.splashscreen.SplashScreenpinkathon"),
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
setContentView(R.layout.activity_splash_screen);
...
}
现在进行测试时,我将com.sharesmile.share.splashscreen.SplashScreenpinkathon更改为com.sharesmile.share.splashscreen.SplashScreenmain它没有反映。似乎是什么问题?