Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
472 views
in Technique[技术] by (71.8m points)

textview - 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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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");

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...