安卓开发桌面,让图标变成圆角
时间: 2023-07-25 19:16:22 浏览: 84
要让安卓开发桌面上的图标变成圆角,可以通过以下步骤实现:
1. 在项目的res/drawable文件夹中创建一个圆角矩形的xml文件,例如rounded_corner.xml:
```
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="10dp" />
</shape>
```
2. 在res/mipmap文件夹中放置你想要使用的图标,例如ic_launcher.png
3. 在res/drawable文件夹中创建一个新的xml文件,例如ic_launcher_round.xml,内容如下:
```
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@android:color/transparent" />
</shape>
</item>
<item android:drawable="@drawable/ic_launcher" android:gravity="center">
<shape android:shape="rectangle">
<corners android:radius="10dp" />
</shape>
</item>
</layer-list>
```
4. 在AndroidManifest.xml文件中设置使用新的图标:
```
<application
android:icon="@drawable/ic_launcher_round"
android:roundIcon="@drawable/ic_launcher_round">
...
</application>
```
这样就可以让安卓开发桌面上的图标变成圆角了。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)