我正在做一个React Native应用程序。我想自定义应用程序图标(意味着你点击启动应用程序的图标)。我在谷歌上搜索过,但我一直在寻找不同类型的图标,它们指的是不同的东西。如何将这些类型的图标添加到应用程序中?
当前回答
在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
其他回答
更新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”)
Android Studio有一个非常方便的图标资产向导,叫做Image asset Studio(用户指南)。它是不言自明的,有一些方便的效果,它是内置的:
截图来自Windows 10上的Android Studio 4.1.3
我将使用一个服务来正确缩放图标。http://makeappicon.com/似乎不错。使用较大尺寸的图像,因为放大较小的图像会导致较大的图标像素化。该网站将为你提供iOS和Android的尺寸。
从那里,它只是一个设置图标的问题,就像你会一个普通的本地应用程序。
https://help.apple.com/xcode/mac/8.0/#/dev10510b1f7
设置Android应用程序图标
使用这个库可以使您的工作更容易。 它将自动化您的图标生成过程
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
推荐文章
- 如何设置电子/原子壳应用程序的应用程序图标
- 在react native中隐藏/显示组件
- React-Native:应用程序未注册错误
- 禁用react native按钮
- Android加载JS包失败
- 在React Native中使用Fetch授权头
- 如何在React中使用钩子强制组件重新渲染?
- 在应用程序启动时出现“无法获得BatchedBridge,请确保您的bundle被正确打包”的错误
- 在没有开发服务器的情况下在设备上构建和安装unsigned apk ?
- 网络请求失败
- 如何在。net中创建和使用资源
- 如何在React Native中浮动?
- 在React Native中获取一个视图的大小
- Axios获取url工作,但第二个参数作为对象,它不
- 什么是useState()在React?