[英]How to change the app tray icon in android programmatically?
我已經動態更改了應用程序圖標和應用程序名稱。 但是應用程序圖標和應用程序名稱更改后,應用程序啟動圖標不會更改。 請指導。
我使用活動別名概念切換了應用程序圖標和名稱。 查看問題圖片:問題圖片
代碼:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.batpoc">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases, you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="bat poc"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity-alias
android:label="bat poc"
android:name=".MainActivityDefault"
android:enabled="true"
android:icon="@mipmap/ic_launcher"
android:targetActivity=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:name=".MainActivityOneLaunch"
android:enabled="false"
android:logo="@mipmap/th"
android:label="One Launch"
android:icon="@mipmap/th"
android:targetActivity=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity-alias>
</application>
我覺得是手機的問題。 手機可能已經存儲了應用程序的一些緩存文件,因此圖標沒有更改。 只需清除應用程序的數據,然后將其卸載,然后重新啟動手機,然后再次構建應用程序。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.