java
java

Reputation: 1339

Using different drawable folders based on screen sizes?

I want to add tablet graphics but android (I use eclipse) is not looking in the correct drawable folder. I made new folders (in /res) drawable-large-ldpi (for each density) and drawable-xlarge-ldpi (for each density) but when I run the application on my tablet it is still getting the images out of the medium sized drawables folder (drawable-ldpi). I thought that adding drawable-large and drawable-xlarge would make android look in the correct folder for the screen size but apperently not.

What am I doing wrong? Do I need to implement something, or declare the new drawable folders somewhere.

Upvotes: 0

Views: 1212

Answers (3)

Stephan Branczyk
Stephan Branczyk

Reputation: 9385

Only 0.1% of android devices have both an xlarge and an ldpi screen at the same time.

Not only that, but you should only use the size qualifiers on a drawable when the drawable is a bitmap image that takes the entire width or the entire height of the screen (like for instance when you use a bitmap image as a background image for the entire screen).

For most drawables (barring the exception I just mentioned), you should get rid of your size qualifiers, and only keep the density qualifiers.

Upvotes: 0

Skd_2014
Skd_2014

Reputation: 61

SimonSays is right. For drawable you don't need to suffix large, xlarge etc. You should suffix the device density only like ldpi, hdpi, xhdpi etc. So remove all the folders with drawable-large-* and drawable-xlarge-* folders and just keep drawable-ldpi, drawable-hdpi etc for each screen density you are supporting.

Upvotes: 1

SimonSays
SimonSays

Reputation: 10977

I think you are mixing size and resolution in the folder name. You should use only one of both, not both (drawable-large instead of drawable-large-hdpi). Look here for the correct folder names.

Upvotes: 0

Related Questions