[英]app icon has white circle around it for android on phonegap/cordova
I updated phonegap, and now the Android icon shows a white circle around it like 1/2 of the icons on my phone.我更新了 phonegap,现在 Android 图标周围显示了一个白色圆圈,就像我手机上 1/2 的图标一样。 I don't want the white circle.
我不想要白色圆圈。
Attached shows the Arlo icon which is normal, then two other icons with white circles around them.附件显示的是正常的 Arlo 图标,然后是另外两个带有白色圆圈的图标。 My config.xml has the icons listed to a png that does not look like this.
我的 config.xml 中列出的图标不是这样的 png。
How can I get my icon without the circle again, like the Arlo icon?如何再次获得没有圆圈的图标,例如 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>
I did fix it but I honestly can't recall exactly everything I did.我确实修复了它,但老实说,我不记得我所做的一切。 Here's what I remember for sure.
这是我肯定记得的。
1) I updated to cordova 8.0.0 (not sure if this is required) 1)我更新到cordova 8.0.0(不确定是否需要)
2) Removed all android icon configs from config.xml, except I left: 2)从 config.xml 中删除了所有 android 图标配置,除了我离开了:
<icon src="icon.png" />
3) Generate Adaptive Icons with Android Studio (Pretty easy): https://developer.android.com/studio/write/image-asset-studio#create-adaptive 3) 使用 Android Studio 生成自适应图标(非常简单): https ://developer.android.com/studio/write/image-asset-studio#create-adaptive
The following steps must be done every time you use phonegap prepare android (or cordova prepare android ), and of course if you rm/add the platform.每次使用phonegap prepare android (或cordova prepare android )时都必须执行以下步骤,当然如果您 rm/add 平台。
4) Copy the generated drawable/values folders/files from Android Studio to approot/platforms/android/app/src/main/res 4)将生成的drawable/values文件夹/文件从Android Studio复制到approot/platforms/android/app/src/main/res
5) Double check the approot/platforms/android/app/src/AndroidManifest.xml has this piece: 5)仔细检查 approot/platforms/android/app/src/AndroidManifest.xml 有这块:
<application android:hardwareAccelerated="true" android:icon="@mipmap/icon" android:label="@string/app_name" android:supportsRtl="true">
There's probably a better way, but my app is working with adaptive icons and I'm happy.可能有更好的方法,但我的应用程序正在使用自适应图标,我很高兴。 Hopefully this helps.
希望这会有所帮助。 Sorry I cannot remember all the details!
对不起,我不记得所有的细节!
Zomg, way late but I spent 2 hours figuring this out and want to share! Zomg,太晚了,但我花了 2 个小时才弄清楚这一点并想分享!
I used Android Studio to create the icon, starting from a new blank project.我使用 Android Studio 从一个新的空白项目开始创建图标。 I was able to figure out how to get to the icon generator from the description here , though I feel like I got lucky finding it, so if you need it, you can pay the $40 to view the video to see where that interface is.
我能够从这里的描述中弄清楚如何使用图标生成器,虽然我觉得我很幸运找到了它,所以如果你需要它,你可以支付 40 美元来观看视频,看看那个界面在哪里。 Then, I copied the files generated from the /app/src/main/res folder in that project, to my /res/icons/android directory.
然后,我将从该项目中的 /app/src/main/res 文件夹生成的文件复制到我的 /res/icons/android 目录中。
Then, I added this to config.xml (I have other things inside this block too, but this is the relevant stuff:然后,我将它添加到 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>
I'm not fully sure if the appcompat line is necessary so you can try without it if you like.我不完全确定 appcompat 线是否是必要的,因此如果您愿意,可以尝试不使用它。 I did also need to remove the android platform & re-add each time I made a change, to get it to notice the change.
我确实还需要在每次进行更改时删除 android 平台并重新添加,以使其注意到更改。 At one point I also deleted the folder .idea/caches to clear cache.
在某一时刻,我还删除了文件夹 .idea/caches 以清除缓存。 All that, and now it works!!
所有这一切,现在它的工作原理! I think it's a better solution than the accepted answer here, because you aren't mucking with the platforms folder & thus won't need to hand-copy things every time, once and done.
我认为这是一个比这里接受的答案更好的解决方案,因为您不会使用平台文件夹,因此不需要每次都手动复制内容,一次完成。 Hope this saves someone some time!
希望这可以节省一些时间!
It looks like application taking first icon of ldpi from config.xml
file看起来应用程序从
config.xml
文件中获取了 ldpi 的第一个图标
try adding尝试添加
<icon src="www/res/android/ldpi.png" />
without density, outside of platform tag in config file and size of 1024x1024 so it will use full space of an app icon.没有密度,在配置文件中的平台标记之外,大小为 1024x1024,因此它将使用应用程序图标的全部空间。
I get this white border in Android 10, but on my older Android phone the icon looks perfect.我在 Android 10 中得到了这个白色边框,但在我的旧 Android 手机上,这个图标看起来很完美。
I guess this is just Android/Samsungs way of prefering native apps over Web-View?我想这只是 Android/Samsungs 偏爱本机应用程序而不是 Web-View 的方式?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.