Android: Change splash screen based on language

人走茶凉 提交于 2019-12-20 05:39:27

问题


I have an app with different splash screen.. One for italian language and one for the english one. How can I set my app to choose the correct image based on system language?


回答1:


You can put different drawables and layouts in different resource directories such as:

res/drawable-en/
res/drawable-it/
res/layout-en/
res/layout-it/

en for english and it for italian. It might be best to keep the "default" resources in the standard directories with no language specifier.

If you name the actual files inside those directories as the same name, then the system will automatically pick the correct file depending on the users locale.

See Android Docs for more information.




回答2:


http://developer.android.com/training/basics/supporting-devices/languages.html

you can use multiple resource folders and it will load images based on device locale/config

having the folders with prefix will automatically detect/load for local

eg

res/layout-en/
res/layout-it/


来源:https://stackoverflow.com/questions/14822870/android-change-splash-screen-based-on-language

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!