Nuraiz
Nuraiz

Reputation: 1070

Alternative Drawables

I am developing a game and want to support all screens which have 240dp density. These screens lies in hpdi-category of Android e.g. some tablets like 10.1" and 7.0", some phones which have 480*800 screens, etc. Can you please tell me how to provide alternative drawables. Thanks in advance.

Upvotes: 0

Views: 1424

Answers (3)

Janusz
Janusz

Reputation: 189454

You can use size or density qualifiers for your drawable folder. If you for example have a fullscreen background drawable for a tablet and for a phone you can create a drawable-xlarge folder. This folder will be used on a table only. You could also combine the ressource qualifiers like drawable-xlarge-hdpi. For more information on this read Providing Ressources.

I would suggest to specifiy your layout by screen size only. Resulting in four layout folders layout-small, layout-normal, layout-large, layout-xlarge. The normal drawables that only need a bigger resolution with a higher screen density like buttons or other stuff that is shown in the same size on phones and tablets should be put into the density dependent folders like (drawable-ldpi, drawable-mdpi, drawable-hdpi, drawable-xhdpi).

Upvotes: 0

oldnemesis
oldnemesis

Reputation: 86

Answering the next question, you can qualify for the whole range of options, from current locale to display width/height. See http://developer.android.com/guide/topics/resources/providing-resources.html#AlternativeResources

Upvotes: 0

user387184
user387184

Reputation: 11053

Just put the drawable files into the drawable-hdpi or drawable-mdpi folder respectively.

For full control depending on your needs you might want to check http://developer.android.com/guide/practices/screens_support.html

Here you find all the possibilities...

You may especially check the new size qualifiers. In particular (also from the link above):

For other cases in which you want to further customize your UI to differentiate between sizes such as 7” and 10” tablets, you can define additional smallest width layouts:

res/layout/main_activity.xml           # For handsets (smaller than 600dp available width)
res/layout-sw600dp/main_activity.xml   # For 7” tablets (600dp wide and bigger)
res/layout-sw720dp/main_activity.xml   # For 10” tablets (720dp wide and bigger)

Upvotes: 2

Related Questions