Android App更改應(yīng)用的圖標(biāo)的實(shí)現(xiàn)方法
Android App更改應(yīng)用的圖標(biāo)的實(shí)現(xiàn)方法
一般情況下,我們App圖標(biāo)在Androidmanifest.xml中設(shè)置,通過(guò)Application android:icon屬性指定,寫(xiě)法如下:
<?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>
因新年來(lái)臨等,產(chǎn)品需要針對(duì)最新版本更換一個(gè)應(yīng)用圖標(biāo)。OK,一分鐘搞定,如上,直接替換app_icon.png圖標(biāo)即可。
然而,測(cè)試同學(xué)發(fā)現(xiàn),替換圖標(biāo)后,在小米5、華為6plus、樂(lè)視樂(lè)1S、小米2s、魅族MX5等手機(jī)上應(yīng)用依然顯示以前圖標(biāo)。
取巧處理方法:
通過(guò)應(yīng)用入口Activity android:icon屬性重新指定新圖標(biāo)。目前通過(guò)測(cè)試,實(shí)測(cè)基本及時(shí)生效(部分機(jī)型自帶主題除外)。寫(xiě)法如下:
<?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>
通過(guò)入口Activity android:icon="@drawable/new_app_icon" 指向新的應(yīng)用圖標(biāo)。
以上就是Android 更改圖標(biāo)的實(shí)例詳解,如有疑問(wèn)請(qǐng)留言或者到本站社區(qū)交流討論,感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!
- Android如何動(dòng)態(tài)改變App桌面圖標(biāo)
- Android實(shí)現(xiàn)動(dòng)態(tài)改變app圖標(biāo)的示例代碼
- Android實(shí)現(xiàn)修改狀態(tài)欄背景、字體和圖標(biāo)顏色的方法
- Android 修改app圖標(biāo)和名稱的方法
- android開(kāi)發(fā)修改狀態(tài)欄背景色和圖標(biāo)顏色的示例
- Android改變ExpandableListView的indicator圖標(biāo)實(shí)現(xiàn)方法
- Android 改變圖標(biāo)原有顏色和搜索框的實(shí)例代碼
- Android動(dòng)態(tài)修改應(yīng)用圖標(biāo)與名稱的方法實(shí)例
相關(guān)文章
Android數(shù)據(jù)傳輸中的參數(shù)加密代碼示例
這篇文章主要介紹了Android數(shù)據(jù)傳輸中的參數(shù)加密代碼示例,具有一定參考價(jià)值,需要的朋友可以了解下。2017-11-11
Android IPC進(jìn)程間通信詳解最新AndroidStudio的AIDL操作)
這篇文章主要介紹了Android IPC進(jìn)程間通信的相關(guān)資料,需要的朋友可以參考下2016-09-09
Android studio 如何刪除項(xiàng)目 module
本篇文章主要介紹了Android studio 如何刪除項(xiàng)目module的相關(guān)知識(shí),具有很好的參考價(jià)值。下面跟著小編一起來(lái)看下吧2017-05-05
Android 中Popwindow彈出菜單的兩種方法實(shí)例
這篇文章主要介紹了Android 中Popwindow彈出菜單的兩種方法實(shí)例的相關(guān)資料,這里提供了兩種實(shí)現(xiàn)的方法,并附有實(shí)例代碼,需要的朋友可以參考下2017-03-03
Android實(shí)現(xiàn)在線預(yù)覽office文檔的示例詳解
在移動(dòng)端展示在線 Office 文檔(如 Word、Excel、PPT)是一項(xiàng)常見(jiàn)需求,這篇文章為大家重點(diǎn)介紹了兩種方案的實(shí)現(xiàn)方法,希望對(duì)大家有一定的幫助2025-04-04

