Android TextView from XML does not show some special characters (capital phi)
I am trying to get formatted text and special characters from strings.xml. I have no problem getting rich text (bold, superscript, index, etc.) or getting some Greek characters (beta, eta), even Chinese characters. But what I cannot get is the greek character "capital phi" (HTML: Ο). Does anyone know how to do this?
Here is the code I am using.
strings.xml
<resources>
<string name="beta">β</string>
<string name="eta">η</string>
<string name="phi">ϕ</string>
<string name="zhongwen">δΈΊδ»δΉεοΌ</string>
<string name="area"><b>A</b><sub><small>s,t</small></sub> [cm<sup><small>2</small></sup>]</string>
</resources>
MainActivity.java
public class MainActivity extends ActionBarActivity {
TextView textView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textView = (TextView)findViewById(R.id.text_view);
textView.setTextSize(50);
textView.setGravity(Gravity.CENTER);
textView.setText(getText(R.string.beta));
textView.append(getText(R.string.eta));
textView.append(getText(R.string.phi));
textView.append(getText(R.string.zhongwen));
textView.append(getText(R.string.area));
}
}
+3
source to share
1 answer