Featured post

Marshmallow Features Point by Point

Android Runtime (“ART”) Improved application performance and lower memory overhead for faster  multi-tasking. Battery Doze...

Monday, 9 February 2015

Different Language text/unicode display in TextView

When any different language text display in TextView only we have two option.

1) Add .ttf file for particular text/Unicode

2) html format

Example for first option
========================

String s="(Mouy t'ngai) (១ ថ្ងៃ)";
TextView text_view1 = null;
text_view1 = (TextView) findViewById(R.id.textView2);
Typeface font= Typeface.createFromAsset(getAssets(), "khmerOS.ttf");
text_view1.setTypeface(font);
text_view1.setText(s);

// you can use different type of .ttf like
TAU_BHON.TTF
molten.ttf
arialuni.ttf

Example of Second option
============================
tv.setText(Html.fromHtml("\\u27A1");

No comments:

Post a Comment