如何添加字体在Android应用程序
问题描述:
我在该应用程序使一个应用程序的Android 2.2 我想显示在TextView中的Android应用程序印地文文本。 (如何添加मैंछात्रहूँ的文字字)
i am making one application in Android 2.2 in that application i want to show hindi text in TextView in Android application. (how to add "मैं छात्र हूँ" word in Text view)
请帮我..
答
添加您的字体资产的文件夹中的项目并使用下面的代码片段
Add your font to assets folder in your project and use the below snippet
TextView hindiTextView=(TextView)findViewById(R.id.txtbx);
Typeface hindiFont=Typeface.createFromAsset(getAssets(),"fonts/fontname.ttf");
mytextView.setTypeface(hindiFont);
希望它帮助。
Hope its helpful.