开发者

android layout according to language selected

I would like to know if there is any good idea how to switch layouts according to application language selected - e.g. switch between left-to-right layout and right-to-left layout开发者_开发知识库. Have different images or written text and ofcourse the position.

I thought doing it using a private member in the application that indicates the current language selected. According to this parameter I can choose the related XML and text etc. Actualy I might create some LayoutFactory class, although I don't really think it is required.

But will have to create the realted layout XMLs. Is there any option to put subdirectories under he layout? Or should I name the files like en_.xml and he_.xml etc?


For values and drawable you can add folders like values-fr for French or values-ja for Japanese. The -fr indicates that if your phone is set to French localization the app will use any folder that has the -fr added to its name. I'm guessing this goes for the layout folder aswell.

You can read about Localization here .

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜