如何设置TextView的古吉拉特语中的Andr​​oid应用程序? [英] How to set gujarati for textview in the android application?

查看:96
本文介绍了如何设置TextView的古吉拉特语中的Andr​​oid应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我需要显示在古吉拉特语TextView的一个应用程序。

I want to make a application in which i needs to show the textview in gujarati language.

我试着用

Typeface tf = Typeface.createFromAsset(getAssets(), "G-SARAL1.TTF");
text.setTypeFace(tf);

但是这不是工作,我设置string.xml文件中的古吉拉特语的文字,然后我设置TextView的该字符串,但是当我运行应用程序,它显示正方形boxs,而不是性格古吉拉特语,

but this is not working, I set the gujarati text in string.xml file and then i set that string in the textview, but when i run the application, it display square boxs instead of gujarati character,

谁能帮助我,我怎么能实现这个任务。

can anyone help me , how can i implement this task.

推荐答案

作为古吉拉特和印地文语言不被支持的Andr​​oid,你仍然可以给支持您的应用程序。

As gujarati and hindi languages are not supported by Android, you can still give that support to your Application.

有关古吉拉特复制 C:\\ WINDOWS \\ Fonts \\中Shruti.TTF 文件到您的资产文件夹。然后使用以下code。

For Gujarati copy the C:\WINDOWS\Fonts\Shruti.TTF file to your asset folder. Then use the following code.

    TextView text_view = new TextView(this);
    Typeface font = Typeface.createFromAsset(getAssets(), "Shruti.TTF");
    text_view.setTypeface(font);
    text_view.setText("ગુજરાતી");

Shruti.TTF 文件是古吉拉特语字体。同样,您可以添加印地文文件的支持。

Shruti.TTF file is for Gujarati font. Similarly you can add support for hindi file.

这篇关于如何设置TextView的古吉拉特语中的Andr​​oid应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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