เตรียมไฟล์ icon (icon.png) และ Splash Screens (splash.png) โดยนำไปไว้ในโฟลเดอร์ resources
ไฟล์ที่ใช้เตรียมเป็น Splash Screens ควรมีขนาด 1920×1920 พิกเซล
โดยมีสีพื้นทั้งภาพ และเอาภาพที่ต้องการจริงๆอยู่ตรงกลางภาพ
เมื่อเตรียมทั้ง 2 ไฟล์ เสร็จ ต่อมาก็ใช้คำสั่ง ionic cordova resources
เพื่อทำการ crop และ resize images
ดูวิธีใช้คำสั่ง
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
> ionic cordova resources --help ionic cordova resources - Automatically create icon and splash screen resources Ionic can automatically generate perfectly sized icons and splash screens from source images (.png, .psd, or .ai) for your Cordova platforms. The source image for icons should ideally be at least 1024×1024px and located at resources/icon.png. The source image for splash screens should ideally be at least 2732×2732px and located at resources/splash.png. If you used ionic start, there should already be default Ionic resources in the resources/ directory, which you can overwrite. You can also generate platform-specific icons and splash screens by placing them in the respective resources/<platform>/ directory. For example, to generate an icon for Android, place your image at resources/android/icon.png. By default, this command will not regenerate resources whose source image has not changed. To disable this functionality and always overwrite generated images, use --force. For best results, the splash screen's artwork should roughly fit within a square (1200×1200px) at the center of the image. You can use https://code.ionicframework.com/resources/splash.psd as a template for your splash screen. ionic cordova resources will automatically update your config.xml to reflect the changes in the generated images, which Cordova then configures. Cordova reference documentation: - Icons: https://cordova.apache.org/docs/en/latest/config_ref/images.html - Splash Screens: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-splashscreen/ This command uses Ionic servers, so we require you to be logged into your free Ionic account. Use ionic login to login. Usage: $ ionic cordova resources [<platform>] [options] Inputs: platform ................. The platform for which you would like to generate resources (android, ios) Options: --force, -f .............. Force regeneration of resources --icon, -i ............... Generate icon resources --splash, -s ............. Generate splash screen resources Examples: $ ionic cordova resources $ ionic cordova resources ios $ ionic cordova resources android |
สั่งสำหรับ android
1 |
> ionic cordova resources android |
Link