A
A
ape3642015-11-26 09:55:34
Android
ape364, 2015-11-26 09:55:34

How to display ruble symbol ₽ in TextView?

Hello.
How to display ruble sign in textView through code? Those. something like tvCost.setText(orderCost + "₽"). When setting this character in the xml markup, everything is OK (for example, android:text="250 ₽"), but when trying to set the text using setText(), it's a disaster.
I tried both char and String, and the symbol "₽" itself, and its representation in Unicode "/u20BD" and even through getResources().getString() as well as "₽" and "/u20BD" - the result is zero, just nothing displayed in place of this character.
UPD: the problem is observed in the Genymotion emulator (Google Nexus 4, Android 4.2.2, API 17), on a Nexus 5 phone with Android 6.0 everything is ok.
UPD: solution is a picture instead of a symbol in the comments to LeEnot 's answer

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
LeEnot, 2015-11-26
@ape364

Try like this:
The fact is that on some fonts in Android there is no ruble symbol .
You need to set a custom font where this character is present like this:

Typeface myFont = Typeface.createFromAsset(getAssets(),"fonts/NotoSans-Regular.ttf");
tvCost.setTypeface(myFont);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question