android10 launcher icon round corner
时间: 2023-12-11 15:02:43 浏览: 33
如果你想在 Android 10 中的启动器图标上添加圆角,可以使用以下步骤:
1. 首先,在你的 `drawable` 文件夹中创建一个新的图标资源文件,并命名为 `ic_launcher_round.xml`。
2. 在文件中添加以下代码:
```xml
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
```
这段代码定义了一个自适应图标,并将背景设置为 `ic_launcher_background` 资源文件中的颜色,将前景设置为 `ic_launcher_foreground` 资源文件中的图标。
3. 接下来,在 `values` 文件夹中的 `styles.xml` 文件中添加以下代码:
```xml
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:roundIcon">@drawable/ic_launcher_round</item>
</style>
```
这段代码将你的应用程序主题与新的启动器图标关联起来。
4. 最后,在 `AndroidManifest.xml` 文件中的 `application` 标签中添加以下代码:
```xml
<application
...
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round">
...
</application>
```
这段代码将应用程序的默认图标设置为 `ic_launcher` 资源文件中的图标,并将圆角图标设置为 `ic_launcher_round` 资源文件中的图标。
完成这些步骤后,你的应用程序的启动器图标应该具有圆角效果。