我有一个 TextView,中间有一个巨大的文本,我有一个泰米尔语单词,我知道如何在单独的 TextView 中嵌入泰米尔语字体。但我需要英语单词之间的泰米尔语单词,请提前帮助谢谢
我在 TextView 中的部分文本:
Seasonal messages like welcome (நல்வரவு) is used in Kolam. Volunteering to draw kolam at temple is sometimes done when a devotee's
最佳答案
尝试设置这个 Akshar.ttf通过 setTypeface 将字体添加到您的 TextView,它支持英语和泰米尔语。
结果如下:
或者,寻找支持两种语言的类似字体。
您的第二个解决方案是使用 SpannableStringBuilder 为这个小的泰米尔语文本部分使用图像。
为TextView设置自定义字体的代码:
假设您在 assets 文件夹下的 fonts 文件夹中有 Akshar.ttf 字体:
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");
关于英文单词之间的安卓泰米尔字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10635516/