0

I have used this Unicode character U+2300. But its not reflection in Android Textview. I have used it in both xml layout and in java class.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Anshul
  • 147
  • 2
  • 13

2 Answers2

0

Try this.

String str = "\u2300";
textView.setText(str);
Sabyasachi
  • 3,499
  • 2
  • 14
  • 21
  • 2
    Just blurting out code without explanation is not what Stack Overflow is about. [Take the Tour](https://stackoverflow.com/tour) and [How to write a good answer](https://stackoverflow.com/help/how-to-answer) – Rob Dec 03 '18 at 13:37
0

Encodings of Unicode Character 'DIAMETER SIGN'

HTML Entity (decimal)               ⌀

HTML Entity (hex)                   ⌀

How to type in Microsoft Windows    Alt +2300

UTF-8 (hex)                         0xE2 0x8C 0x80 (e28c80)

UTF-8 (binary)                      11100010:10001100:10000000

UTF-16 (hex)                        0x2300 (2300)

UTF-16 (decimal)                    8,960

UTF-32 (hex)                        0x00002300 (2300)

UTF-32 (decimal)                    8,960

C/C++/Java source code              "\u2300"

Python source code                  u"\u2300"

In Android, you can not use this Unicode directly in your text view tag, but first you have to store the string value in your string.xml file and then use it from there

EX.

<string name="save">SAVE \u2300</string>

<TextView
     android:id="@+id/btnSave"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:text="@string/save"/>

Output :

enter image description here

Prince Dholakiya
  • 3,255
  • 27
  • 43
  • 1
    when the `strings.xml` is saved in UTF-8 encoding, it should even work with the literal symbol; notice the tiny indicator in Android Studio; at the bottom of the editor window. – Martin Zeitler Dec 03 '18 at 10:36