If you want to have a different splash screen in dark mode/theme, you have to provide a different file e.g. To do that, open Android/app/src/main/res/values/styles.xml and under LaunchTheme resource set android:windowBackground as in the snippet below. Next, we have to set our launch_background.xml as a splash screen.If you also have a drawable-v21 directory present, which in my case, was generated together with the whole project, you can remove the mentioned directory or place there the same launch_background.xml file as in the drawable directory. This file will represent the look of our splash screen. Then, we need to modify the Android/app/src/main/res/drawable/launch_background.xml file.After generating all required images, place them in appropriate directories in Android/app/src/main/res.if you want to use an image of 200x200 pixels in your app, you should provide an image of 800x800 pixels because that is the highest resolution used by some Android devices ( drawable-xxxhdpi). Remember to provide high-resolution image as an input, e.g. To generate all required resolutions of images, I have used the website (but this one is also cool ). If you are not familiar with drawables, I highly recommend reading that article explaining the topic in detail. In this case, place these images in directories called drawable with different suffixes. Run the app… and, unfortunately, we can notice a black screen between our beautiful splash screen and the first page of the app.įor Android, we also need our icon image in different resolutions for different devices. “ LaunchBackgroundColor” and “ LaunchImage” are assets added in a previous steps. And then set the appearance of our new splash screen using “ Launch Screen” key.To do that, delete the “ Launch screen interface file base name” key. Next, we have to remove information about using the storyboard as our splash screen in ist file.Add AssetImage as in the 2nd step for Storyboard.We are able to define different colors for light and dark themes. Then, add New Color Set inside Assets.xcassets.Remove LaunchScreen.storyboard file using Xcode (it is important to use Xcode to remove all dependencies to that file).The second approach uses ist file (Information Property List). TIP 1: If you can’t see changes to your splash screen, try to delete the app from the phone/simulator, restart the phone/simulator, go to Xcode→Product→Clean Build Folder. Our splash screen should appear after building the app. Then, we need to set a background color in LaunchScreen.storyboard as in the image below.As you can see in the image below, we need to provide 3 different resolutions of an icon: 1x, 2x and 3x (more details here) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |