You can also test your icons by installing your app on a Google Pixel device.īut not too much else. One way to test your resources is to run the Android emulator and use a Google APIs Emulator System targeting API level 25. You should make sure to test your app on devices that support the new circular icons, to see how your circular app icons look and how they are displayed. You can use Image Asset Studio to design round icons. Because of this, apps should make sure to define both android:icon and android:roundIcon resources when responding to launcher intents. When a launcher requests an app icon, the framework returns either android:icon or android:roundIcon, depending on the device build configuration. All rights reserved.Android 7.1 Notes wrote:Apps can now define circular launcher icons, which are used on devices that support them. The source code for this article is available here. So, aside from this one bug in the build tools, the new icon tools are really useful and should make life much easier. I have raised an issue, so hopefully this will be fixed soon. This fix will be to change this folder to mipmap-anydpi-v26. It is the : assets which are being placed in this folder, yet only devices running Android O will actually recognise this format hence the failure on Lollipop to Nougat. The contents of mipmap-anydpi-v21 are the cause. It’s easy to see what the problem is using the APK analyser built in to Android Studio: This is on a Nexus 9 running Nougat 7.1.1: However, if we run it on a device running anything between Lollipop (API 21) and Nougat (API 25) the default system icon will be used. If we run this on a device running KitKat or earlier, or Android O preview, then everything is fine. The default ic_launcher.png and ic_launcher_round.png icons which were the default from the project creation are those that will be overwritten. The files shown in red are those that already exist and will be overwritten: The final stage is a check of which output files will be generated. In this case I have no need for a Play Store icon (as I won’t be publishing this app to the play store) so I have disabled it. That really simplifies the task of generating both square and round icons after round icons were introduced in Nougat 7.1. This is quite interesting because we can actually generate static legacy icons from our adaptive assets. Next we switch to the “Legacy” tab which allows us to control the legacy icon types which will be generated: Next we need to switch to the “Background Layer” tab and add our background image: We can see already that the odd ‘tail’ on the long shadow is now outside the bounds of all of the icons which will be generated. Next we’ll change the asset type to “Image” and select our foreground layer in the “Foreground Layer” tab: We’re interested in launcher icons so we’ll stick with the default selection of “Launcher Icons (Adaptive and Legacy)”. The icon type dropdown enables us to specify different types of icon that we may want to create, including ActionBar and notification icons. This brings up the all new image creation tools: To create the adaptive icon we right click on the res folder in the project view in Android Studio, and select New | Image Asset: I found a royalty-free background image in a complementary colour to the predominant green of the foreground component: The bottom right edge looks weird but, don’t worry, this won’t be visible in the final icon. While the launcher doesn’t do anything yet, there may be some interesting stuff coming soon…įor the foreground of the adaptive icon I’m using a version of the Styling Android logo with a long shadow effect: This enables the launcher to do some funky effects. The main concept of adaptive icons is that the foreground and background layers are separate. We’ll look at how I went about creating the new adaptive form of this icon. For these sample apps, I like to use an appropriate Styling Android launcher icon. I would therefore suggest a quick read through of this article to decide whether it is worth your while implementing these just yet.Īs regular readers will be aware, the vast majority of articles on Styling Android are accompanied by a sample app which demonstrates the concepts being discussed. While the documentation already provides an explanation of the icon tools within Android Studio, it is these that we’ll focus on to see how they can provide assistance even for legacy icons.īefore we continue it is worth pointing out that there a currently really big pain point with backwards compatibility which we’ll get to at the end. There is already a good explanation of Adaptive Icons in the official documentation which give some explanations of why Adaptive Icons have been introduced, and hint at some of the ways that they will be used going forward.
0 Comments
Leave a Reply. |