Tuesday, 12 August 2014

Android Studio Icon Generator: How to Generate Icons for different screen densities using Android Studio

Hello Friends, today we will see how to generate Icons for different screen density Android devices using Android Studio.

While developing android app, if we need to use any icon in the app (including launcher icons), we need them in all different screen densities as below:

mdpi: 48*48
hdpi: 72*72
xhdpi: 96*96
xxhdpi: 144*144

Given an icon of any resolution,  Android Studio comes with in built facility to auto generate icons for all above screen resolutions (thereby avoiding need for Android Developer to learn any photo editing tool or take help of expert in this field) and it also puts them in their respective folders ( drawable-mdpi , drawable - hdpi etc.) , thus saving developer's time as well.

Below are steps you need to follow to auto generate icons for your app.
(Note:I assume you have Android Studio installed and using it for your android app development. Also steps 1 to 6 are for creating a new project in Studio, if you already have project created, you can directly refer from step 7).

1. Launch Android Studio and click on File > New Project


2. Input Application Name (e.g. Test Application)  and Company Domain (e.g. testapps.com) and also specify Project Location where you wish to save your project.


3. Then click Next button. Now Check Phone and Tablet as Platform and select Minimum SDK version.


4. Then click Next button. Select Blank Activity.

5. Click Next Button and Specify Activity Name, Layout Name and Title.

6. Click on Finish Button. A New Project in Android Studio has been successfully created with Project Name as TestApplication and Module name as app.

7. Now Right Click on module name ('app' in our case) under Project (TestApplication in our case).
Then select New >  Image Asset.

8. Asset Studio Icon Generator screen appears now.

9. This screen now gives you option to select Image (of any resolution from local PC/laptop) .

For this browse Image file from your computer. You can see preview also on the same screen. You may also design your icons further  by using Padding, Scaling, Shape and Background Color features.

You can also update Resource name field for your icon to match its reference in resource files.

If you don't have a ready-made icon for your needs, you can still design one using Clipart or Text option under 'Foreground'.

Once selected all the options as desired and previewed the icons, Click  Next button.

10. Android Studio now confirms Target module and Res Directory where your icons will be saved.
Click Finish button.
11. You may confirm whether icons have been successfully generated and placed in their respective directory by checking contents of drawable-hdpi, drawable-xhdpi etc.

So we are done creating icons for difference screen densities and placing them in appropriate folder!!!

Hope this post was useful.

We will meet again soon with something new and interesting. Till then, take care.

No comments:

Post a Comment