开发者

Localization and drawables

开发者 https://www.devze.com 2023-01-31 02:34 出处:网络
I want to localize an image by adding the folder res/drawable-hdpi-no, but I get开发者_如何学C an error stating \"invalid resource directory name\".What\'s up with this?Each Android resource can have

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


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.


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


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


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

Localization and drawables

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

Localization and drawables

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号