表现:
<application
android:name="..."
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/MyTheme"
tools:replace="icon,label,theme,name,allowBackup">
Run Code Online (Sandbox Code Playgroud)
在mipmap-anydpi-v26我定义的文件夹下ic_launcher.xml:
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/white"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Run Code Online (Sandbox Code Playgroud)
的build.gradle:
compileSdkVersion = 26
buildToolsVersion = "25.0.2"
supportLibVersion = "25.3.1"
targetSdkVersion = 25
minSdkVersion = 18
Run Code Online (Sandbox Code Playgroud)
而且,我正在使用android studio 3.0
但最终结果是我得到了一个默认的android图标而不是我提供的图标.
我也尝试将前景png放在所有的密度文件夹(mipmap-xhdpi等)中,虽然我在执行此操作时只使用相同的png进行测试