I am working on a android app which uses 29 different languages. I have created the layout according to english language in my resources folder but when the laguage changes the text views n text size changes and overlaps. Is there any way to keep the layouts constant for all laguages so that alignment of textviews and texts remain same?
3 Answers
yes very easy. you create for each language a values folder like values-de
or values-en
in each folder you can create strings.xml
<string name="no_items">there are no items</string>
this is for the english one. create it for each language.

- 1,585
- 2
- 14
- 26
-
thanks for your answer but i dont want to change the string i want to keep my layout constant i.e graphical layout – Ravi Ranjan Jun 05 '12 at 10:35
If you read the developer documents (here: http://developer.android.com/guide/topics/resources/localization.html#strategies), there is a good description of your problem and some ways to go about solving it. See the section "Design a flexible layout"
You can:
a) Provide different layouts per language with different layout files per language (although this can add a large amount of overhead for you to maintain your app)
or
b) Make a more flexible layout, so when long strings are passed in due to the language, everything adjusts by itself. Then you don't need to worry about which language the user is running in (or can create a lot less layouts specific to the language if some still don't look right).

- 789
- 7
- 16
you can extend TextView to adjust text size automatically to fit in.. an example of custom TextView is given in this answer https://stackoverflow.com/a/3378422/886001