如何为我的Android应用程序设置图标?
当前回答
把你的图像放在drawables文件夹下的三个和设置它像这样。
Code
<application android:icon="@drawable/your_icon" >
....
</application>
其他回答
1 .在Photoshop或Coreldraw中创建图标,大小为256*256
注意,如果你想要一个透明的图标,请使用PNG文件格式
2 .在https://romannurik.github.io/AndroidAssetStudio/icons-launcher.html上传你的图标
3 .在这个网站上进行设置
4 .点击下载按钮,下载网页自动生成的zip文件
5 .解压压缩文件并复制res文件夹到你的项目库
注意,res文件夹包含所有大小图标
6-最后你需要设置清单使用图标
<application android:icon="@drawable/your_icon" >
....
</application>
为android应用程序定义图标
<application android:icon="drawable resource">
....
</application>
https://developer.android.com/guide/topics/manifest/application-element.html
如果你的应用适用于多种设备
你应该为所有广义屏幕密度创建单独的图标, 包括低、中、高、超高密度屏幕。这 确保图标在的范围内正确显示 可以安装应用程序的设备…
尺寸及格式
启动器图标应该是带有alpha通道的32位png 透明度。完成的启动器图标尺寸对应于 给定广义屏幕密度如下表所示。
将图标放置在mipmap或可绘制文件夹中
android:icon="@drawable/icon_name"或android:icon="@mipmap/icon_name"
developer.android.com/guide说,
此属性必须设置为对可绘制资源的引用 包含图像(例如“@drawable/icon”)。
关于启动器图标android-developers.googleblog。com说,
最好的做法是把你的应用程序图标放在mipmap-文件夹(而不是 可绘制-文件夹),因为它们用于不同的分辨率 器件的电流密度。例如,xxxhdpi应用程序图标可以是 用于xxhdpi设备的启动器上。
来自谷歌(Android Framework)的Dianne Hackborn说,
如果你为不同的应用程序构建不同的版本 密度,您应该了解“mipmap”资源目录。 这与“可绘制的”资源非常相似,只是它不是 在创建不同apk时参与密度剥离 目标。
对于启动器图标,AndroidManifest.xml文件必须引用mipmap/ location
<application android:name="ApplicationTitle"
android:label="@string/app_label"
android:icon="@mipmap/ic_launcher" >
再引用一下这个
You want to load an image for your device density and you are going to use it "as is", without changing its actual size. In this case you should work with drawables and Android will give you the best fitting image. You want to load an image for your device density, but this image is going to be scaled up or down. For instance this is needed when you want to show a bigger launcher icon, or you have an animation, which increases image's size. In such cases, to ensure best image quality, you should put your image into mipmap folder. What Android will do is, it will try to pick up the image from a higher density bucket instead of scaling it up. This will increase sharpness (quality) of the image.
此外,您可以读取mipmap和可绘制的文件夹
易于生成资产的工具
Android Asset Studio by romannurik.github Android Asset Studio by jgilfelt.github Image Asset Studio(from Android Studio) 材质图标生成器 Android材质设计图标生成器插件github.com/konifar 从SVG文件生成android资产的脚本
阅读更多信息:https://developer.android.com/guide/practices/ui_guidelines/icon_design_launcher.html
在AndroidManifest中更改这些:
android:icon="@drawable/icon_name"
android:roundIcon="@drawable/icon_name"
你必须遵循以下步骤:
你会看到你的默认图标ic_launcher.png,像这样:
您必须更改mimmap -xxxx文件夹中的所有映像。 首先,你必须创建自己的徽标或拾取图像,你想放置作为启动器的图标,并上传这里的Android资产工作室-图标生成器-启动器图标,你将从该链接获得所有的mimmap -xxxx和web_icon。
现在你要复制所有文件夹在res文件夹旁边,
现在转到Android Studio项目->右键单击分辨率文件夹->粘贴。它会提示你文件'ic_launcher.png'已经存在于目录中,你可以按覆盖所有。它将在相应的文件夹中粘贴/替换图像。
现在您可以运行并看到带有新图像的应用程序图标。
快乐编码:):)
转到文件>新>图像资产。
从他们,你可以为你的图标创建图像资产。
之后,我们将得到图标图像在mipmap不同的格式像 hdpi、mdpi xhdpi、xxhdpi xxxhdpi。
现在去安德罗舱单xml
<application android:icon="@mipmap/your_Icon"> ....</application>
推荐文章
- 警告:API ' variable . getjavacompile()'已过时,已被' variable . getjavacompileprovider()'取代
- 安装APK时出现错误
- 如何设置电子/原子壳应用程序的应用程序图标
- 碎片中的onCreateOptionsMenu
- TextView粗体通过XML文件?
- 如何使线性布局的孩子之间的空间?
- DSL元素android.dataBinding。enabled'已过时,已被'android.buildFeatures.dataBinding'取代
- ConstraintLayout:以编程方式更改约束
- PANIC: AVD系统路径损坏。检查ANDROID_SDK_ROOT值
- 如何生成字符串类型的buildConfigField
- Recyclerview不调用onCreateViewHolder
- Android API 21工具栏填充
- Android L中不支持操作栏导航模式
- 如何在TextView中添加一个子弹符号?
- PreferenceManager getDefaultSharedPreferences在Android Q中已弃用