Reputation: 14453
I have two unfocused TextView
in the single layout. I want to show Arabic text on one TextView
and English text on another TextView
. I have use values/strings.xml
for English and values-ar/strings.xml
for Arabic text. My problem is Arabic text not showing in the TextView
. If I change the custom locale to ar
means its showing. How to show the Arabic text without changing the custom locale?
Upvotes: 0
Views: 9416
Reputation: 4829
To do this we need the font file for Arabic fonts. For example ,we have the Arabic font file name as arabicfont.ttf. Save this file into the assets folder then use the bellow code
arabicTextview.setTypeface(Typeface.createFromAsset(getContext().getAssets(),"arabicfont.ttf"));
arabicTextView.setText("ur text");
Like wise we can set any type of text with out using the Locale
Upvotes: 1
Reputation: 1393
Its default behaviour for Android. It will take locale information from system and map appropriate string resource from values-ar. Text you want to show in Arabic you have to take entry in values/strings.xml and have to put those arabic character that you want to display.
please share the result when you tried this.
Upvotes: 1