Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I insert special characters as text in XML editor for Android?

So, I'm writing an app that involves using some mathematical symbols. I'm doing this in the visual XML editor. Is there any way I can get, say, an integral symbol, or a "less than or equal to" symbol? Things like that.

Thanks!

like image 947
Taylor Matyasz Avatar asked Dec 23 '11 08:12

Taylor Matyasz


2 Answers

Use &lt; for <, &gt; for > and &amp; for &.

or

<   less than   &lt;    
>   greater than    &gt;    
&   ampersand   &amp;   
¢   cent            &cent;  
£   pound           &pound; 
¥   yen         &yen;   
€   euro            &euro;  
§   section         &sect;  
©   copyright   &copy;  
®   registered trademark    &reg;   
™   trademark   &trade;
like image 148
NikhilReddy Avatar answered Sep 28 '22 02:09

NikhilReddy


Try put they as HTML.

String htmlStringWithMathSymbols = "&#8804;  &#8805;";

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

Here you can display your math symbol in textView

Here the post http://www.hrupin.com/2011/12/how-to-put-some-special-math-symbols-in-textview-editview-or-other-android-ui-element

Hope, it help you!

like image 25
ihrupin Avatar answered Sep 28 '22 03:09

ihrupin