簡體   English   中英

應用程序圖標周圍有白色圓圈,適用於 phonegap/cordova 上的 android

[英]app icon has white circle around it for android on phonegap/cordova

我更新了 phonegap,現在 Android 圖標周圍顯示了一個白色圓圈,就像我手機上 1/2 的圖標一樣。 我不想要白色圓圈。

附件顯示的是正常的 Arlo 圖標,然后是另外兩個帶有白色圓圈的圖標。 我的 config.xml 中列出的圖標不是這樣的 png。

如何再次獲得沒有圓圈的圖標,例如 Arlo 圖標?

<platform name="android">
    <!--
        ldpi    : 36x36 px
        mdpi    : 48x48 px
        hdpi    : 72x72 px
        xhdpi   : 96x96 px
        xxhdpi  : 144x144 px
        xxxhdpi : 192x192 px
    -->
    <icon src="res/android/ldpi.png" density="ldpi" />
    <icon src="res/android/mdpi.png" density="mdpi" />
    <icon src="res/android/hdpi.png" density="hdpi" />
    <icon src="res/android/xhdpi.png" density="xhdpi" />
    <icon src="res/android/xxhdpi.png" density="xxhdpi" />
    <icon src="res/android/xxxhdpi.png" density="xxxhdpi" />
</platform>

在此處輸入圖像描述

我確實修復了它,但老實說,我不記得我所做的一切。 這是我肯定記得的。

1)我更新到cordova 8.0.0(不確定是否需要)

2)從 config.xml 中刪除了所有 android 圖標配置,除了我離開了:

<icon src="icon.png" />

3) 使用 Android Studio 生成自適應圖標(非常簡單): https ://developer.android.com/studio/write/image-asset-studio#create-adaptive

每次使用phonegap prepare android (或cordova prepare android )時都必須執行以下步驟,當然如果您 rm/add 平台。

4)將生成的drawable/values文件夾/文件從Android Studio復制到approot/platforms/android/app/src/main/res

5)仔細檢查 approot/platforms/android/app/src/AndroidManifest.xml 有這塊:

<application android:hardwareAccelerated="true" android:icon="@mipmap/icon" android:label="@string/app_name" android:supportsRtl="true">

可能有更好的方法,但我的應用程序正在使用自適應圖標,我很高興。 希望這會有所幫助。 對不起,我不記得所有的細節!

Zomg,太晚了,但我花了 2 個小時才弄清楚這一點並想分享!

我使用 Android Studio 從一個新的空白項目開始創建圖標。 我能夠從這里的描述中弄清楚如何使用圖標生成器,雖然我覺得我很幸運找到了它,所以如果你需要它,你可以支付 40 美元來觀看視頻,看看那個界面在哪里。 然后,我將從該項目中的 /app/src/main/res 文件夾生成的文件復制到我的 /res/icons/android 目錄中。

然后,我將它添加到 config.xml (我在這個塊中也有其他東西,但這是相關的東西:

<platform name="android">
    <!-- Depend on v21 of appcompat-v7 support library -->
    <framework src="com.android.support:appcompat-v7:21+" />
    <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
        <application android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" />
    </edit-config>
    <resource-file src="res/icons/android/drawable/ic_launcher_background.xml" target="app/src/main/res/drawable/ic_launcher_background.xml" />
    <resource-file src="res/icons/android/drawable-v24/ic_launcher_foreground.xml" target="app/src/main/res/drawable-v24/ic_launcher_foreground.xml" />
    <resource-file src="res/icons/android/mipmap-anydpi-v26/ic_launcher_round.xml" target="app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml" />
    <resource-file src="res/icons/android/mipmap-anydpi-v26/ic_launcher.xml" target="app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" />
    <resource-file src="res/icons/android/mipmap-hdpi/ic_launcher_foreground.png" target="app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png" />
    <resource-file src="res/icons/android/mipmap-hdpi/ic_launcher_round.png" target="app/src/main/res/mipmap-hdpi/ic_launcher_round.png" />
    <resource-file src="res/icons/android/mipmap-hdpi/ic_launcher.png" target="app/src/main/res/mipmap-hdpi/ic_launcher.png" />
    <resource-file src="res/icons/android/mipmap-mdpi/ic_launcher_foreground.png" target="app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png" />
    <resource-file src="res/icons/android/mipmap-mdpi/ic_launcher_round.png" target="app/src/main/res/mipmap-mdpi/ic_launcher_round.png" />
    <resource-file src="res/icons/android/mipmap-mdpi/ic_launcher.png" target="app/src/main/res/mipmap-mdpi/ic_launcher.png" />
    <resource-file src="res/icons/android/mipmap-xhdpi/ic_launcher_foreground.png" target="app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png" />
    <resource-file src="res/icons/android/mipmap-xhdpi/ic_launcher_round.png" target="app/src/main/res/mipmap-xhdpi/ic_launcher_round.png" />
    <resource-file src="res/icons/android/mipmap-xhdpi/ic_launcher.png" target="app/src/main/res/mipmap-xhdpi/ic_launcher.png" />
    <resource-file src="res/icons/android/mipmap-xxhdpi/ic_launcher_foreground.png" target="app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png" />
    <resource-file src="res/icons/android/mipmap-xxhdpi/ic_launcher_round.png" target="app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png" />
    <resource-file src="res/icons/android/mipmap-xxhdpi/ic_launcher.png" target="app/src/main/res/mipmap-xxhdpi/ic_launcher.png" />
    <resource-file src="res/icons/android/mipmap-xxxhdpi/ic_launcher_foreground.png" target="app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png" />
    <resource-file src="res/icons/android/mipmap-xxxhdpi/ic_launcher_round.png" target="app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png" />
    <resource-file src="res/icons/android/mipmap-xxxhdpi/ic_launcher.png" target="app/src/main/res/mipmap-xxxhdpi/ic_launcher.png" />
 </platform>

我不完全確定 appcompat 線是否是必要的,因此如果您願意,可以嘗試不使用它。 我確實還需要在每次進行更改時刪除 android 平台並重新添加,以使其注意到更改。 在某一時刻,我還刪除了文件夾 .idea/caches 以清除緩存。 所有這一切,現在它的工作原理! 我認為這是一個比這里接受的答案更好的解決方案,因為您不會使用平台文件夾,因此不需要每次都手動復制內容,一次完成。 希望這可以節省一些時間!

看起來應用程序從config.xml文件中獲取了 ldpi 的第一個圖標

嘗試添加

<icon src="www/res/android/ldpi.png" /> 

沒有密度,在配置文件中的平台標記之外,大小為 1024x1024,因此它將使用應用程序圖標的全部空間。

我在 Android 10 中得到了這個白色邊框,但在我的舊 Android 手機上,這個圖標看起來很完美。

我想這只是 Android/Samsungs 偏愛本機應用程序而不是 Web-View 的方式?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM