Search code examples
androidandroid-layoutandroid-studioandroid-support-libraryandroid-vectordrawable

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 ?


Solution

  • 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