简体   繁体   中英

Folders for different screen densities for Android

There are multiple groups of screen densities of Android phones (ldpi, mdpi, hdpi and so on).

I had a folder "drawable" with picture size 1920 x 930 pixels which is for xxxhdpi, I guess.

I want to arrange pictures for all screen densities from xxxhdpi to hdpi. So, I should rename my existing folder: "drawable" -> "drawable-xxxhdpi". Then, I should create 3 additional folders for others. Do I understand it right?

How would actually the program choose proper folder?

For example, I also have smaller pictures now. Should I also resize them? If I don't duplicate them in new folder, will the program crash?

Will the program crash on phones with, for example, hdpi if I don't create a folder for hdpi?

Couldn't get how it works, would be grateful for an explanation.

First of all be sure that you are in the "Project" view because you will not see all the folders if you are in "Android" view. Then instead of renaming drawable folder create the others and keep drawable for some files that doesn't need to resize (for example defining a background). Folders should be:

  • drawable-hdpi
  • drawable-mdpi
  • drawable-xhdpi
  • drawable-xxhdpi
  • drawable-xxxhdpi

Selection between them will be done automatically according to the screen of the device you are installing the app. If screen is xxxhdpi and you don't have a file for that resolution the app will take the smaller and so on. Obviously this will not be a great UI performance but you should not have problems with crashes.

There are many online App icons generators in the web so you can take a big icon and put it there so you get the icons for all sizes

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM