我正在做一个React Native应用程序。我想自定义应用程序图标(意味着你点击启动应用程序的图标)。我在谷歌上搜索过,但我一直在寻找不同类型的图标,它们指的是不同的东西。如何将这些类型的图标添加到应用程序中?


当前回答

如果你使用的是expo,在你的项目中放置一个1024 * 1024的png文件 在app.json中添加一个图标属性。“图标”:“。/ src /资产/程序”

https://docs.expo.io/versions/latest/guides/app-icons

其他回答

Android Studio有一个非常方便的图标资产向导,叫做Image asset Studio(用户指南)。它是不言自明的,有一些方便的效果,它是内置的:

截图来自Windows 10上的Android Studio 4.1.3

这有助于人们努力寻找更好的网站来生成图标和飞溅屏幕

制作应用图标(android和ios都有用) APE工具(android和ios都有用) 图标集创建器(仅适用于ios) android Asset Studio(仅适用于android +推荐*)

使用这个库可以使您的工作更容易。 它将自动化您的图标生成过程

https://www.npmjs.com/package/@bam.tech/react-native-make

Android应用图标: 访问这个网站https://appicon.co/

添加图像和生成图标,应该下载 解压文件夹 在他们的副本中,所有AppIcons/android/文件夹(即文件夹 名称:mipmap-xxxhdpi mipmap-xxhdpi mipmap-xhdpi, mipmap-hdpi mipmap-mdpi) 将上述复制的文件夹粘贴到{rootFolder}/android/app/src/main/res/ 并替换现有的 从AndroidManifest.xml中删除这一行 (android: roundIcon =“@mipmap / ic_launcher_round”)

图标添加成功

更改IOS应用程序图标: 访问这个网站https://appicon.co/

添加图像和生成图标,应该下载 解压文件夹 在他们的副本中,所有的文件夹在AppIcons/Assets中。xcassets /(即。 AppIcon。appiconset文件夹) 粘贴AppIcon。Appiconset文件夹 {rootFolder} / ios / {projectname} /图像。Xcassets /和替换现有的

图标添加成功

在React-Native项目中为Android设备设置应用程序启动图标:

Take a high resolution image of your logo and place it inside your project directory. Preferably in [Project-DIR]/android/app/src/main/res/ Open Android Studio and run your React-native project. In Android Studio's Project window, select the Android view Right-click the res folder and select New > Image Asset A "Configure Image Asset" window will open; Locate your high resolution image and place set it as your "Foreground layer". Set your "Background Layer" if applicable Click "Next" and continue to finish. Run your application again to see the new app launch icon.

官方文档可以在这里找到:https://developer.android.com/studio/write/image-asset-studio