左边是模拟器有白边,右边是手机没有白边。
手机没有白边,应该是手机厂对应用图标做了特殊适配
原因:
android桌面图标是分为前景图层和背景图层
如果直接通过<font style="color:#bcbec4;background-color:#1e1f22;">android:icon="@drawable/iu"</font>设置图片,桌面就直接把这张图片当成年前景图层。
<application
android:allowBackup="true"
<!-- 直接引用图片 -->
android:icon="@drawable/iu"
android:label="@string/app_name"
android:roundIcon="@drawable/iu"
android:supportsRtl="true"
android:theme="@style/Theme.BaseUI">
<activity
android:name=".ViewActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
解决方法:
- 右键点击 res 文件夹,然后依次选择 New > Image Asset
- 将background设置成想要的图片
最后效果如下: