如何设置TextView的在马拉雅拉姆语字体(一位印度当地语言)的安卓2.2 [英] How to set textview in malayalam font(An Indian local language) in android 2.2

查看:228
本文介绍了如何设置TextView的在马拉雅拉姆语字体(一位印度当地语言)的安卓2.2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要证明的TextView 的马拉雅拉姆语字体这是印度当地的语言。对于这个我想下面code

I need to show TextView in malayalam font which is an indian local language. For this I am trying below code

        Typeface custom_typerface = Typeface.createFromAsset(getAssets(), "fonts/AnjaliNewLipi.ttf");
        TextView mytext = (TextView)findViewById(R.id.mytext);
        mytext.setTypeface(custom_typerface);
        mytext.setText("മലയാള ഭാഷ തന്‍ ഭാവ ശുദ്ധി...");

此正确地显示了一个4.2的设备上,但不是在所有设备。我怎样才能使之为所有Android设备?任何帮助将AP preciated。

This shows correctly on a 4.2 device, but not in all devices. How can I render it for all android devices? Any help will appreciated.

推荐答案

最后,我发现了一个漫长的寻找之后,答案.. 我转换的Uni code字型到ASCII,通过更换每使用ASCII每统一code字符。 这里是神奇的code

At last I found the answer after a long search.. I converted Unicode fonts to Ascii,by replacing each and every Unicode character with Ascii. Here is the magic code

mytext.replaceAll("oldChar", "newChar");

使用code为每一个单个字符。 :)

use this code for each and every single character. :)

这篇关于如何设置TextView的在马拉雅拉姆语字体(一位印度当地语言)的安卓2.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆