Android Character.UnicodeBlock for various languages -help needed
ok, so like many others out there I have been trying to make an Android app that displays portions of my content in other languages. I thought Character.UnicodeBlock would be the obvious staring place but it isnt working for me.
I am calling the content from an xml file and using a font which I belives supports many different languages (DejaVuSans.ttf). I have tried making the content in the base language or actual unicode format but either way no joy.
Am I on the right track? or barking up the wrong tree? The annoying this is that I know it can be done as I have apps that display differnt languages! BTW I know about using various xml files for different locales but thats not what I am trying to do here.
This is my code so far
package com.ll.lang;
import android.app.Activity;
import android.graphics.Typeface;
import android.os.Bundle;
import android.widget.TextView;
public class homeActivity exten开发者_如何转开发ds Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView tv;
tv= (TextView) findViewById(R.id.content);
Typeface tf = Typeface.createFromAsset(getAssets(),
"fonts/DejaVuSans.ttf");
Character.UnicodeBlock block = Character.UnicodeBlock.of (tv);
tv.setTypeface(tf);
}
}
精彩评论