• App 更换应用图标


    一般情况下,我们App图标在Androidmanifest.xml中设置,通过Application android:icon属性指定,写法如下:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.myapp">
    
        <application
            android:name=".ApplicationContext"
            android:allowBackup="false"
            android:icon="@drawable/app_icon"
            android:label="@string/app_name"
            android:theme="@style/BaseTheme">
    
            ....
            .....
    
        </application>
    </manifest>

    因新年来临等,产品需要针对最新版本更换一个应用图标。OK,一分钟搞定,如上,直接替换app_icon.png图标即可。

    然而,测试同学发现,替换图标后,在小米5、华为6plus、乐视乐1S、小米2s、魅族MX5等手机上应用依然显示以前图标。

    。。。。

    取巧处理方法:

    通过应用入口Activity android:icon属性重新指定新图标。目前通过测试,实测基本及时生效(部分机型自带主题除外)。写法如下:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.myapp">
    
        <application
            android:name=".core.application.ApplicationContext"
            android:allowBackup="false"
            android:icon="@drawable/app_icon"
            android:label="@string/app_name"
            android:theme="@style/BaseTheme">
    
            ....
    
            <activity
                android:name=".activity.MainActivity"
                android:icon="@drawable/new_app_icon"
                android:launchMode="singleTop"
                android:screenOrientation="portrait"
                android:theme="@style/BaseTheme.SplashScreen"
                android:configChanges="keyboardHidden|orientation|screenSize">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
    
    
            .....
    
        </application>
    </manifest>

    通过入口Activity android:icon="@drawable/new_app_icon" 指向新的应用图标。

    
    
  • 相关阅读:
    python+opencv 运行环境搭建
    centos 安装 FLEXPART
    centos 安装npm node
    USACO4.3 Street Race【分析】
    USACO4.3 Letter Game【枚举·细节】
    结构体封装高精度 大整数BigInt
    POJ3585 Accumulation Degree【换根dp】
    换根dp特征总结
    HDU2196 Computer【换根dp】
    CF1187E Tree Painting【换根dp】
  • 原文地址:https://www.cnblogs.com/lwbqqyumidi/p/6279487.html
Copyright © 2020-2023  润新知