-1

enter image description here

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

Jan Slominski
  • 2,968
  • 4
  • 35
  • 61
徐佳灵
  • 11
  • 2

2 Answers2

0

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.

wake-0
  • 3,918
  • 5
  • 28
  • 45
0

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

PathoS
  • 439
  • 4
  • 9