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


当前回答

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

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

其他回答

在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

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

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

我遵循了他的建议并使用android Asset Studio在react-native android项目中添加了应用图标

以下是为防止链接失效而转录的内容:

如何在React-Native Android上传应用程序图标

1)上传你的图像到Android Asset Studio。 选择任何你想应用的效果。该工具为您生成一个zip文件。点击下载。zip。

2)在你的机器上解压缩文件。然后拖动你想要的图片到你的/android/app/src/main/res/文件夹。确保将每个图像放在正确的子文件夹mipmap-{hdpi, mdpi, xhdpi, xxhdpi, xxxhdpi}。

3)不要(像我最初做的那样)天真地将整个文件夹拖放到你的res文件夹上。因为你可能会删除你的/res/values/{strings,styles}.xml文件。

我将使用一个服务来正确缩放图标。http://makeappicon.com/似乎不错。使用较大尺寸的图像,因为放大较小的图像会导致较大的图标像素化。该网站将为你提供iOS和Android的尺寸。

从那里,它只是一个设置图标的问题,就像你会一个普通的本地应用程序。

https://help.apple.com/xcode/mac/8.0/#/dev10510b1f7

设置Android应用程序图标

就像Rockvic所说的,iOS和Android需要不同大小的图标。此外,如果有人感兴趣,我推荐这个网站生成不同大小的图标。你不需要下载任何东西,它工作得很完美。

https://resizeappicon.com/

希望能有所帮助。