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">&#946;</string>
    <string name="eta">&#951;</string>
    <string name="phi">&#981;</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


This is because the android font does not have these characters. All you have to do is download a compatible font, test it on your computer (word Ms, wordpad). Then put the font file in your android resource folder and look at some tutorials or use libraries like fontify.



+1


source







All Articles