Alexiz Hernandez
Alexiz Hernandez

Reputation: 359

How to deisgn icons and images for Android

Is there any specific way that icons and other images should be designed in Android? I am trying to design some images that will be used in ImageButton. The problem is that when I run the app in different emulators, sometimes they are way too big for small screen. I am designing them according to this:

mdpi - x1.0

hdpi - x1.5

xhdpi - x2.0

xxhdpi - x3.0

xxxhdpi - x4.0

How to properly design image resources for Android ?

Upvotes: 0

Views: 353

Answers (4)

GPack
GPack

Reputation: 2504

The sizes are correct, you need to define the buttons' dimension as XXdp (pixel relative to medium density) or "wrap_content" in the xml layout. Notice that this way covers the different definition's issue, not the different screen dimension's issue.

Upvotes: 0

Siddhesh Dighe
Siddhesh Dighe

Reputation: 2954

You can either use Vectors or Images as icons in your app

  1. For Using Vectors

    • Right Click on /res folder

      enter image description here

    • Choose Vector Asset, you can either choose default icons provided by android or use a local image as shown

      enter image description here

  2. Using Images

    • Right click on /res folder and choose Image Asset

      enter image description here

    • Choose the type of icon you want to make (eg. Launcher icon, Notification icon etc)

      enter image description here

    • Choose your image and let Android Studio do the rest of the work for you

      enter image description here

Upvotes: 0

Farhad
Farhad

Reputation: 12996

You can use Vector Drawables for creating image resources. The benefits of using vector images are :

1- You only provide one image for all densities and you don't have to create multiple files for different screen.

2- You have access to Material icons directly from the Android Studio from which you can choose your desired icons and convert them automatically to vector drawables.

3- Since Support Library 23.2 and Gradle plugin 1.5, these Vector Drawables are backward compatible with API below 21.

I recommend you to study the following tutorials and documentation to get started with using Vector resources.

Vector Drawables | Android Developers

How to use Vector Drawables in Android

Upvotes: 2

TapanHP
TapanHP

Reputation: 6191

The best way to make drawables file is Android Assets studio I always use it to generate icons as it also let you download icons in all densities so you not need to worry about it.
Another best way to make Vector icons so for rest of your project no need to worry about icons size issues and If you want to know how to create vector drawables then Let me know in comments.
Thanks.

Upvotes: 0

Related Questions