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


当前回答

更新2022

因为阿尔莫罗的答案已经不复存在了

Android和iOS图标

你现在可以在iOS和Android上用一个命令生成圆形图标:

npx icon-set-creator create ./path/to/icon.png

我强烈建议使用至少1024x1024像素的图标

自适应Android图标

npx icon-set-creator create -b <background> -f <foreground> -A

background—颜色(例如:“#ffffff”)或图像资产(例如:“资产/图片/ christmas-background.png”)

前景-图像资产(例如:“资产/图片/ christmas-foreground.png”)

其他回答

我想建议使用react-native-vector-icons将图标导入到您的项目。当你使用矢量图标时,你不需要担心图标缩放方面。在使用该软件包时,您可以使用所有流行的图标集,如fontawesome, ionicons等。

除了这些图标集,你也可以把你自己的图标打包为一个ttf文件,你可以直接导入到android和ios项目react-native项目。您可以使用相同的react-native-vector-icons库来管理这些图标

下面是设置自定义图标的详细过程

https://medium.com/bam-tech/add-custom-icons-to-your-react-native-application-f039c244386c

在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

有人专门为这项任务制作了一个非常容易使用的工具:https://www.npmjs.com/package/app-icon

这个简单的工具允许您在react-native项目中创建单个图标,然后从它创建所有所需大小的图标。它目前适用于iOS和Android。

我用过。制作一个512x512的png文件,然后运行该工具,完成。超级简单。

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

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

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

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