Display all Unicode chars in TextView
tv=(TextView)findViewById(R.id.textView1);
Typeface font= Typeface.createFromAsset(getAssets(), "TAU_BHON.TTF");
tv.setTypeface(font);
Place the font that will support your language in the assets folder.In this case i have used TAU_BHON.TTF
Unicode characters not displayed in TextView.setText
Unfortunately, you just can't do it that way from strings.xml AFAIK.
You're left doing one of two things.
Adding the Unicode character within java to the String in the XML file:
String str = "\u00A9" + getContext().getString(R.string.your_string);
Entering the text as HTML in java:
yourTextView.setText(Html.fromHtml("your chars"));
Hope this is useful.
How to show Unicode character in a TextView in Android?
You can parse unicode from html to string by using HTML
library like
val bullet = "•"
print("this is bullet a ${Html.fromHtml(bullet)}")
How can I display special characters (like –) in the TextView?
You can use the Html.fromHtml()
to handle HTML formatted text into a Spannable
that TextView
can display.
Android: TextView, unicode character not shown properly
Some fonts don't support some characters. Check your message is shown with other font; include the ttf file on your assets folder, and set the content of the TextView with that font with something like:
yourTextView=(TextView)findViewById(R.id.idOfYourTextView);
Typeface font= Typeface.createFromAsset(getAssets(), "The_Font.TTF");
yourTextView.setTypeface(font);
Hope it helps.
Related Topics
How to Track Time in Libgdx(Android)
Why Getapplicationcontext() in Constructor of Activity Throws Null Pointer Exception
How to Attach Image from Drawable to Gmail
Kotlin and Firebase Read and Write Data
Applying Word Stemming in Searchview for Fetch Data from Firebase Database
Google Play App Description Formatting
What Are the Android Sdk Build-Tools, Platform-Tools and Tools? and Which Version Should Be Used
Allow Multi-Line in Edittext View in Android
How to Make Edittext Not Editable Through Xml in Android
How to Record Video from Background of Application:Android
Android Screen Size Hdpi, Ldpi, Mdpi
Gridview VS Gridlayout in Android Apps
How to Change Screen Orientation in the Android Emulator
What Is Meant by Ems? (Android Textview)
How to Connect with Remote Debugger
How to Modify Ripple Color When Using Attr/Selectableitembackground as Background