سؤال

I'm already working on an Android application that displays RSS feed. My problem is that this feed has some lines in Tamil(which Android still doesn't support)

I found a font online that displays the text right(without converting to Bamini) but the problem is that textStyle doesn't have any effect on it.

so you know any font that can do the job or any thing i have to do to make textStyling? thanks in advance

هل كانت مفيدة؟

المحلول

What you need to do is import custom fonts on to the phone before using them. A good way to do that is to include them in the package - in the APK file

Hence you should be having the font in your project when you build the APK file. Let me give you an example. Assuming your tamil font's name is Harabara.ttf and you have copied it to /assets/fonts

Use this method (anywhere in your activity)

private void initializeFonts() {
    font_harabara = Typeface.createFromAsset(getAssets(), "fonts/Harabara.ttf");
}

and call this API from your onCreate like this

public void onCreate(Bundle savedInstanceState)  {
    super.onCreate(savedInstanceState);
    initializeFonts();          
    setContentView(getViewResourceId());
}

Make sure you have declared this class level variable

Typeface font_harabara = null;

Finally, simply use

myTextField.setTypeface(font_harabara);

tada ! tamil font should now start displaying.

nandri vanakkam,

vaidyanathan

نصائح أخرى

There are hundreds of fonts available online. Did you check some TSCII fonts?

I've written some solutions for Tamil and Android issues. Check it out too.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top