简体   繁体   English

如何根据Android版本拥有不同的应用程序图标版本?

[英]How to have different app icon versions according to the version of Android?

In the AndroidManifest you define the path of your app icon like this 在AndroidManifest中,您可以像这样定义应用程序图标的路径

<application android:label="@string/app_name"
    android:icon="@mipmap/ic_launcher"
    ...
>

But how do I manage to change the icon according to the Android version of the phone ? 但是如何根据手机的Android版本设置更改图标? The design change according to the OS (it should be round with api 25, square with round corners with api < 25), and I can't find how to manage providing a different icon when needed. 根据操作系统的设计变化(它应该是api 25的圆形,带有圆角的方形,api <25),我找不到如何在需要时管理提供不同的图标。

I tried naming the mipmap folder like this : 我尝试命名mipmap文件夹,如下所示:

尝试

But this doesn't work. 但这不起作用。

I didn't find anything about this on google, expect building different APK for different API version... but it is a bit overkill just for an app icon, right ? 我没有在谷歌上找到任何关于这个的东西,期望为不同的API版本构建不同的APK ...但是对于应用程序图标来说有点矫枉过正确对吧?

Use android:roundIcon in your AndroidManifest.xml . AndroidManifest.xml使用android:roundIcon In this case round icon will be used for sdk >= 25. 在这种情况下,圆形图标将用于sdk> = 25。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM