When we create a project to implement an application with the Android Studio development environment, it creates two default icons:
Icons and images are stored in the folder res, there are five folders called:
Mipmap-mdpi Mipmap-hdpi Mipmap-xhdpi Mipmap-xxhdpi Mipmap-xxxhdpi
And in each of these there are two files called ic_launcher.png and ic_launcher_round.png (to see the folders we can select “Project Files”):
Since resolutions of Android devices can be very different (a cell phone, a tablet, a TV, etc.) it is recommended to provide multiple copies of each resource image at different resolutions and store them in the named folders respecting the following rules:
Res / mipmap-mdpi / The icon should be 48 * 48 pixels. Res / mipmap-hdpi / 150% of the size of the images stored in the mipmap-mdpi folder The icon should be 72 * 72 pixels. Res / mipmap-xhdpi / 200% of the size of the images stored in the mipmap-mdpi folder The icon should be 96 * 96 pixels. Res / mipmap-xxhdpi / 300% of the size of the images stored in the mipmap-mdpi folder The icon should be 144 * 144 pixels. Res / mipmap-xxxhdpi / 400% of the size of the images stored in the mipmap-mdpi folder The icon must be 192 * 192 pixels.
Create an application, draw and store ten files called ic_launcher.png and ic_launcher_round.png (delete current ones).
Note that the file that is stored in the mipmap-mdpi folder must be 48 pixels, the mipmap-hdpi folder must be 72 pixels wide and high, the mipmap-xhdpi folder must be 96×96 pixels, The mipmap-xxhdpi folder should be 144 * 144 pixels, and finally, the mipmap-xxxdpi folder should be 192×192 pixels.
Run the application and see the new icon.
In the file AndroidManifest.xml is where we indicate the names of the icons of the application:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.coding180.project024"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
As we see we have the file names ic_launcher and ic_launcher_round (we should not indicate extension)
File names can only have lowercase characters, numbers, and underscore, any other characters will generate an error when we try to run the application. While we can use numbers within the filename, a number can not be located as the first character of the filename (this is because Android Studio generates a resource file and defines a variable with that filename)
There are tools on the Internet that facilitate the generation of the icons for our application: here
How useful was this post?
Click on a star to rate it!
Average rating / 5. Vote count:
We are sorry that this post was not useful for you!
Let us improve this post!
Thanks for your feedback!