Localization and drawables
Asked Answered
O

4

43

I want to localize an image by adding the folder res/drawable-hdpi-no, but I get an error stating "invalid resource directory name". What's up with this?

Orgel answered 14/12, 2010 at 17:24 Comment(0)
A
43

As far as I remember, only certain res folders will work. You need to call it drawable-[language code]-r[capitalised localisation code] if I remember rightly. Pretty sure it's one of the Android Tutorials.

Yeah here it is http://developer.android.com/resources/tutorials/localization/index.html

Away answered 14/12, 2010 at 17:38 Comment(1)
Thanx! I knew I'd seen that tutorial. I just couldn't find it. Though the solution to my direct problem is "res/drawable-no-hdpi" and not "res/drawable-hdpi-no"Orgel
G
46

Each Android resource can have configuration parts in its resource name. For example you might have a plain image on

res/drawable

and a image for a high DPI screen on

res/drawable-hdpi

Here hdpi is a Screen pixel density configration. A list of supported Android resource configurtions can be found from here

http://developer.android.com/guide/topics/resources/providing-resources.html

The order of configurations are important. They must be on specific order. Your original Norwegian language configuration is on a wrong place. Change

res/drawable-hdpi-no

to

res/drawable-no-hdpi

and it works.

Gattis answered 17/11, 2012 at 7:28 Comment(0)
A
43

As far as I remember, only certain res folders will work. You need to call it drawable-[language code]-r[capitalised localisation code] if I remember rightly. Pretty sure it's one of the Android Tutorials.

Yeah here it is http://developer.android.com/resources/tutorials/localization/index.html

Away answered 14/12, 2010 at 17:38 Comment(1)
Thanx! I knew I'd seen that tutorial. I just couldn't find it. Though the solution to my direct problem is "res/drawable-no-hdpi" and not "res/drawable-hdpi-no"Orgel
P
31

yes, it is possible by. drawable-de-rDE-ldpi,drawable-de-rDE-mdpi . use it

Piscina answered 27/9, 2011 at 12:30 Comment(0)
F
2

You can use directly the Android Studio UI to create your Android Resource Directory and providing all parameters you want:

Create Android Resource Directory

then define all the parameters you need (Locale, Density, etc.)...

enter image description here

Then click on OK and your folder will be created correctly.

Fugacity answered 15/11, 2022 at 15:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.