在Android应用程序的非英语单词 [英] Non-English words in android application

查看:144
本文介绍了在Android应用程序的非英语单词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为印度市场内容丰富的应用程序,并且希望以显示印地文(印第安语)。一些文本

I a content rich application for the Indian market and want to show some text in Hindi (Indian language).

一个选择是与文本创建图像,并在活动添加图像。但它变得太复杂创建和管理各种尺寸的图像。

One option is to create image with the text and add the image in the activity. But it becomes too complicated to create and manage images of various sizes.

有什么出路由我可以不与图像显示搞乱文印地文

Is there any way out by which I can display hindi text without messing with the images.

推荐答案

您应该能够简单地在的TextView 显示文本。如果没有正确显示,它可能是一个字体问题。你可以用打包您的应用程序自定义字体,并在的TextView 非常简单地使用它。只要把一个.TTF字体文件(它需要支持文本的统一code编码),在项目的 ./资产文件夹,包括类似于code这在您的活动的的onCreate 方法:

You should be able to simply display the text in a TextView. If it does not display correctly, it's probably a font problem. You can package a custom font with your app and use it in a TextView very simply. Just put a .ttf font file (it needs to support Unicode encoding of your text) in your project's ./assets folder and include code similar to this in your activity's onCreate method:

TextView tv = (TextView) findViewById(R.id.view_for_hindi_text);
Typeface font = Typeface.createFromAsset(getAssets(), "MyHindiFont.ttf");
tv.setTypeface(font);

这篇关于在Android应用程序的非英语单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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