Saravanan Ponnaiah
Saravanan Ponnaiah

Reputation: 81

Using multiple icons in Android application

I am new to Android application development and I have a question on using icons in Android application. I have to use nearly 20 icons in my Android application. For this, should I need to place 20 individual icon PNG files under drawable folder. Or, is there any possibility of consolidating all 20 icons into single PNG file (Image sprite) as an icon set and place that single PNG file in drawable folder? If we can do so, can someone give some pointers on how to do that and referred in application. Thanks.

Upvotes: 0

Views: 295

Answers (3)

iSandeep
iSandeep

Reputation: 715

create different drawable folders and keep the respective image file into that folder.

  1. drawable-ldpi
  2. drawable-hdpi
  3. drawable-xhdpi
  4. drawable-xxhdpi

OR

for more details

Upvotes: 0

activedecay
activedecay

Reputation: 10847

sprites are better used when writing games. if you use the sprite as a texture, then you only have to write the texture into memory once.

i think sprites in your case is a bad idea. think about providing different pixel densities for each sprite: how do you then provide the image boundaries when the sprite needs to display on a device with more pixels?

consider why you would want to do this in the first place. there is already a image importing function in Android Studio that helps you convert a single png to several pixel densities.

Upvotes: 0

Jignesh Mavani
Jignesh Mavani

Reputation: 269

try to put individual icon PNG file for all drawable folder it's make easy to design for all different size device.

Upvotes: 1

Related Questions