Mathematical Symbols in Views

I learn new thing today. If you like to put some mathematical symbols in your text view or edit text or any other view, you can use following code to do so.

Following are some UniCodes for mathematical symbols. You can add more as per your wish.

String htmlStringWithMathSymbols = "−   +   ±   ×   ÷   %   ‰   =   ≠   ≈   ≡   <   >   ≤   ≥   ∞   ⅛   ¼   ⅜   ½   ⅝   ¾   ⅞   ∫   ∂   ∆   ∏   ∑   √   ∟   ∩   ∙   ƒ   ⁄   ";

Then you can use this string to any view like text view like follow.

textView.setText(Html.fromHtml(htmlStringWithMathSymbols));

Html.fromHtml will parse your string with HTML format and you will get resulted output like follow.


Next Recommended Reading Recycler View With Android DataBinding