The text becomes garbled when I use Chinese characters on Android Things device.
Asked
Active
Viewed 196 times
-1

Jan Slominski
- 2,968
- 4
- 35
- 61

徐佳灵
- 11
- 2
-
which encoding do you use? – wake-0 Dec 24 '16 at 07:55
-
I use utf-8 to encode – 徐佳灵 Dec 24 '16 at 09:28
-
Can you give us some more information, some code etc. – wake-0 Dec 24 '16 at 09:32
-
I just use the Chinese like"你好" in a TextView,it will be garbled like the picture above – 徐佳灵 Dec 24 '16 at 09:37
2 Answers
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

PathoS
- 439
- 4
- 9