Android 模拟器的阿拉伯语文本支持 [英] Arabic text support for Android Emulator

查看:20
本文介绍了Android 模拟器的阿拉伯语文本支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的 Android 应用程序中显示阿拉伯语文本.我正在为 Android 1.6 开发应用程序.

I would like to display Arabic text in my Android application. I am developing the application for Android 1.6.

问题是,当我运行应用程序时,我只能看到方框而不是阿拉伯文字.

Problem is, when i run the application i can only see square boxes instead of Arabic text.

谷歌搜索后,我发现必须添加阿拉伯语的字体(*.ttf -true type font).[ http://www.mydigitallife.info/2010/07/02/how-to-install-and-add-hebrew-arabic-and-unsupported-language-fonts-to-android-电话/ ].但解决方案是针对真实设备的.此外,模拟器中的大多数命令 [ex: su,mkdir,chmod 等] 都是不允许的.

After google'ing i found the font(*.ttf -true type font) for Arabic has to be added. [ http://www.mydigitallife.info/2010/07/02/how-to-install-and-add-hebrew-arabic-and-unsupported-language-fonts-to-android-phone/ ]. But the solution is for real devices. More over in emulator most of the commands [ex: su,mkdir,chmod etc] are not permitted.

我正在使用 Windows XP、Eclipse 3.5.2、Android 1.6.我所需要的只是在模拟器中显示阿拉伯语文本的解决方案.

I'm working on windows XP, Eclipse 3.5.2, Android 1.6. All i need is a solution to display Arabic text in emulator.

您在这方面的任何努力都受到我的尊重:-)

Any of your effort in this regard is respected from my side:-)

推荐答案

我已经从朋友那里得到了解决上述问题的方法..

I've got solution from my friend for the above said prob..

在这里分享同样的内容..

And sharing the same here..

如果您有 .ttf 文件,那么首先在 eclipse 中打开您的项目并将 .ttf 文件复制到 assets 文件夹中,该文件夹将在您的项目层次结构中.然后打开要使用该字体的 .java 文件,然后按照以下步骤操作:-

If you are having .ttf file then first of all open your project in eclipse and copy .ttf file into the assets folder, which will be in your project hierarchy. and then open .java file where you want to use that font and just follow these steps:-

First
Typeface font1;
TextView txt1;
EditText edtxt;

第二:在 onCreate 方法中只需写下这段代码.

Second: In onCreate Method just write down this code.

/*here fonttype.ttf is the file which was copied in assets folder.*/

font1 =Typeface.createFromAsset(getAssets(),"fonttype.ttf");
txt1 =(TextView) findViewById(R.id.user_id_txt);
txt1.setTypeface(font1);

edtx = (EditText) findViewById(R.id.editText);
edtx.setTypeface(font1);

这样你的问题就解决了.

by this your problem will solve.

所有功劳都归我的朋友所有

All credits goes to my friend

这篇关于Android 模拟器的阿拉伯语文本支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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