Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Tamil font between english word

I am having a TextView that has a huge text in between i have a tamil word and i know how to embedd the tamil font in seperate textview .but i need the tamil word between english word please help thanks in advance

my part of text in textview :

Seasonal messages like welcome (நல்வரவு) is used in Kolam. Volunteering to draw kolam at temple is sometimes done when a devotee's

like image 722
Thiru VT Avatar asked May 17 '12 12:05

Thiru VT


People also ask

How can I type Tamil keyboard in English?

Press (Ctrl + G) together to toggle (switch) between English and Tamil language.

Why is Tamil font not showing in Word?

The reason is Character encoding. You have to set character Encoding UTF-8 to see Tamil characters properly on web browsers.

How can I add Tamil font in Mobile?

Under fonts -> add more fonts -> Scripts -> Choose 'Tamil' -> Click the Font Style you like and add it your 'My fonts' (you can see on the right pane). Finally, click Ok to add the fonts.


1 Answers

Try setting this Akshar.ttf font to your TextView through setTypeface, it suuports both English and Tamil.


Here is the outcome:

enter image description here

Or, look for a similar font which supports both language.


your second solution is to use image for this small Tamil text portion using SpannableStringBuilder.


Code for setting custom font to TextView:

Assuming you have the Akshar.ttf font in fonts folder under assets folder:

 Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/Akshar.ttf");               
    TextView tv = (TextView) findViewById(R.id.CustomFontText);
    tv.setTypeface(tf);
    tv.setText("Seasonal messages like welcome (நல்வரவு) is used in Kolam. Volunteering to draw kolam at temple is sometimes done when a devotee's");
like image 192
Imran Rana Avatar answered Sep 21 '22 13:09

Imran Rana