Displaying japanese instead of chinese in a textview

android, internationalization

Solution

There's no way to set the font directly in XML.

If you plan on using a lot of Japanese TextViews, it may be easier to create a custom View to handle it for you, which sets the font programmatically from its constructor(s).

Then any time you plop your custom View down in XML, it'll have the correct font.

Problem

When displaying japanese text in a textview, android defaults to using a chinese font, showing the wrong characters, exemplified here. Setting the locale to japanese works on the emulator, but doesn't work on my galaxy s3, probably because it doesn't support Japanese. There other solution is to set the font programattically from an asset such as: ``` textView.setTypeface(Typeface.createFromAsset(getAssets(), "DroidSansJapanese.ttf")); ``` but that seems like a bit of a kludge. Is there any way to set the font through the xml layout to one that supports japanese?

Original source