Displaying non-English (specifically Hindi) characters on Android device

无人久伴 提交于 2019-11-27 04:48:51

问题


I have some Hindi text which is not getting displayed on the virtual device. The text is properly displayed in eclipse, and the files are utf-8 encoded.

E.g. I have this resource file:

        <?xml version="1.0" encoding="utf-8"?>
 <resources>

            <string name="hello">Hello World, Jain_aartisActivity!</string>
            <string name="app_name">जैन आरती संग्रेह</string>
     </resources>

But the AVD is unable to display the app_name. It just displays a small rectangle for each hindi character.


回答1:


Try this ::

here i have set hindi font in my textview. you can copy file in assets folder and apply following code :

Typeface face;
face = Typeface.createFromAsset(this.getAssets(), "fonts/hindi.TTF");
tran_banner = (TextView) findViewById(R.id.tran_banner);
            tran_banner.setTypeface(face, Typeface.BOLD);



回答2:


I don't believe that the default fonts on Android devices contain hindi characters. You'll need to package up a hindi font with your app and use that.



来源:https://stackoverflow.com/questions/8602939/displaying-non-english-specifically-hindi-characters-on-android-device

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!