5

I have an application where I defined all the necessary detail, now I want to make it LOCALIZED. I know we have to make value folder and add string where the string of the language other language is declared with same "key".

My question is suppose the heading of my app is "DASHBOARD" which in Spanish is "Tablero de instrumentos" know this contains more letter then we have in ENGLISH so the symmetry of the app gets disturb. What I want is to customize the font-size, according to the Language called, so that it doesn't affect my UI.

James
  • 3,684
  • 26
  • 30
Unique
  • 51
  • 4
  • You could use 3rd party libraries for this. I read about some library on the android arsenal. – Sufian Dec 14 '15 at 11:15
  • Create `values-en(for English)` and `values-es(for spanish)` folder under `res` directory, Then create `dimens.xml` file under both `values-en` and `values-es` folder. and specify create resource specify font size in it. Now use this `dimen` size to set size in widget. – Dhaval Patel Dec 15 '15 at 04:51

2 Answers2

0

I think the solution for you would be here: How to adjust text font size to fit textview

According to this topic you can use:

speedplane's FontFitTextView, but it only decreases font size if needed to make the text fit, and keeps its font size otherwise. It does not increase the font size to fit height.

Note: speedplane is a nick of a guy from StackOverflow forum.

Code: FontFixTextView.java

Community
  • 1
  • 1
piotrek1543
  • 18,676
  • 7
  • 78
  • 92
0

You might want to try this

String language = Locale.getDefault().getDisplayLanguage();

if ( language.equalsIgnoreCase("Spanish") {
    myTextView.setTextSize( font_size );
}
Mann
  • 530
  • 3
  • 13