Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我在 Android Things 设备上使用汉字时,文本变得乱码。
我这样解决。
TextView txtHello = (TextView)findViewById(R.id.txt_hello); txtHello.setTypeface(ResourceCompat.getFont(context, R.font.nanum);
您必须选择支持中文字符的字体:
TextView myText = (TextView) findViewById(R.id.myText); myText.setTypeface(Typeface.createFromAsset(getAssets(), "DroidSans.ttf"));
DroidSans.tff文件需要放在 assets 文件夹中。