phonegap/cordova 上 android 的应用程序图标周围有白色圆圈
app icon has white circle around it for android on phonegap/cordova
我更新了 phonegap,现在 Android 图标周围显示了一个白色圆圈,就像我 phone 上图标的 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>
看起来应用程序从 config.xml
文件
中获取了 ldpi 的第一个图标
尝试添加
<icon src="www/res/android/ldpi.png" />
没有密度,在配置文件中的平台标签之外,大小为 1024x1024,因此它将使用完整的 space 应用程序图标。
我确实修复了它,但老实说我不记得我所做的一切。这是我肯定记得的。
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 folders/files 从 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 创建图标,从一个新的空白项目开始。我能够从描述 here 中弄清楚如何找到图标生成器,虽然我觉得我很幸运找到它,所以如果你需要它,你可以支付 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 以清除缓存。所有这一切,现在它起作用了!我认为这是比此处接受的答案更好的解决方案,因为您不会弄乱平台文件夹,因此不需要每次都手动复制东西,一次完成。希望这可以节省一些时间!
我在 Android 10 上得到了这个白色边框,但在我的老 Android phone 上图标看起来很完美。
我想这只是 Android/Samsungs 比 Web-View 更喜欢原生应用的方式。
我更新了 phonegap,现在 Android 图标周围显示了一个白色圆圈,就像我 phone 上图标的 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>
看起来应用程序从 config.xml
文件
尝试添加
<icon src="www/res/android/ldpi.png" />
没有密度,在配置文件中的平台标签之外,大小为 1024x1024,因此它将使用完整的 space 应用程序图标。
我确实修复了它,但老实说我不记得我所做的一切。这是我肯定记得的。
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 folders/files 从 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 创建图标,从一个新的空白项目开始。我能够从描述 here 中弄清楚如何找到图标生成器,虽然我觉得我很幸运找到它,所以如果你需要它,你可以支付 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 以清除缓存。所有这一切,现在它起作用了!我认为这是比此处接受的答案更好的解决方案,因为您不会弄乱平台文件夹,因此不需要每次都手动复制东西,一次完成。希望这可以节省一些时间!
我在 Android 10 上得到了这个白色边框,但在我的老 Android phone 上图标看起来很完美。
我想这只是 Android/Samsungs 比 Web-View 更喜欢原生应用的方式。