如何为我的Android应用创建圆形图标? [英] How to create a circular icon for my Android app?

查看:78
本文介绍了如何为我的Android应用创建圆形图标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚交换了我的android启动器图标(刚刚学会了如何操作).我注意到我的android上的许多图标是圆形的,我想知道我是否必须完成这样的图像,或者是否可以通过某种方式让启动器放置图标(透明背景的png)并以某种方式为启动器绘制一个圆圈?(这也更容易在某些绘图工具中鬼混).

在应用程序中,我使用CircleImageView作为联系人,但该联系人是在Java中创建圆圈的,而android启动器是xml,因此不确定我是否可以使用CircleImageView?

解决方案

您需要使用

有关更多信息,您可能会发现 Android官方文档很有帮助,以及 Nick Butcher的出色指南.

I just swapped my android launcher icon(just learned how). I noticed MANY icons on my android are circular and I am wondering do I have to get an image done like that OR is there way I can have the launcher put the icon(a png with transparent background) and draw a circle for the launcher somehow? (this would be easier that fooling around in some drawing tool as well).

In the app I used CircleImageView for contacts which did the circle but that was in java, and android launcher is xml so not sure if I can use CircleImageView?

解决方案

You'll need to use adaptive icons instead of a single image to allow Android to adjust your icon. Essentially this is defining a background drawable and a foreground drawable, and Android will do the rest.

If you right click your res/drawable folder in Android Studio, then select New -> Image Asset, you will see the following wizard. This will let you easily create launcher icons that work in all shapes.

For further information you may find the official Android docs helpful, as well as Nick Butcher's excellent guide.

这篇关于如何为我的Android应用创建圆形图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆