While I use Chinese in the Android Things the text becomes garbled

200 views Asked by At

enter image description here

The text becomes garbled when I use Chinese characters on Android Things device.

2

There are 2 answers

3
wake-0 On

You have to select a font which supports the chinese characters:

TextView myText = (TextView) findViewById(R.id.myText);
myText.setTypeface(Typeface.createFromAsset(getAssets(),
        "DroidSans.ttf"));

The DroidSans.tff file needs to be placed in the assets folder.

0
PathoS On

I solve this way.

code

TextView txtHello = (TextView)findViewById(R.id.txt_hello);
txtHello.setTypeface(ResourceCompat.getFont(context, R.font.nanum);

resource

font file location