Reputation: 359
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
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
Reputation: 2954
You can either use Vectors or Images as icons in your app
For Using Vectors
Using Images
Upvotes: 0
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
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