欢迎来到 Android人的问与答 ,在这里提问或帮助他人解答。 Question2Answer的1.6.x和1.7.x版本的中文翻译包我修改更新:

Question2answer

如何使用中文语言包

Q2A 1.6.x - Chinese Simplified (简体中文)

Q2A 1.7.x - Chinese Simplified (简体中文)


国内服务器推荐 阿里云服务器
国外服务器推荐 DigitalOcean
VPN推荐 正版Green VPN
阿里云推荐码:ldvq50

Android中如何支持阿拉伯文字

0 喜欢 0 不喜欢
362 浏览

Android 2.1 does not have Arabic font.

Android 2.2 has Arabic font but does not show your word correctly.

Android 3.x supports Arabic completely.

For Android 2.1 you must set the typeface Farsi.GetFarsiFont(this) and then use Farsi.Convert("سلام")

For Android 2.2 you do not need setting font but must use Farsi.Convert("سلام")

And for Android 3.x forget all of the above solutions ;). But you can change the font if you do not like the 3.x Arabic font.

so do the following steps:

1) At first add "TAHOMA.TTF" in assets folder

2) use the following class to get the font and converting your Arabic or Farsi text to a good form for showing in your activities.

import android.content.Context;
import android.graphics.Typeface;

public final class Farsi {

    public static boolean isFarsiConversionNeeded = true;

    private final static String szLamAndAlef = Character
            .toString((char) 0xfedf)
            + Character.toString((char) 0xfe8e); // Lam + Alef

    private final static String szLamStickAndAlef = Character
            .toString((char) 0xfee0)
            + Character.toString((char) 0xfe8e); // Lam (Sticky !!!)+
                                                    // Alef

    private final static String szLa = Character.toString((char) 0xfefb); // La
    private final static String szLaStick = Character.toString((char) 0xfefc); // La
                                                                                // (Sticky!!!)

    private final static String szLamAndAlefWoosim = Character
            .toString((char) 0xe1)
            + Character.toString((char) 0xbb); // Lam + Alef

    private final static String szLamStickAndAlefWoosim = Character
            .toString((char) 0x90)
            + Character.toString((char) 0xbb); // Lam (Sticky !!!)+
                                                // Alef

    private final static String szLaWoosim = Character.toString((char) 0xd9); // La
    private final static String szLaStickWoosim = Character
            .toString((char) 0xd9); // La

    // (Sticky!!!)

    private static final class struc {
        public char character;
        public char endGlyph;
        public char iniGlyph;
        public char midGlyph;
        public char isoGlyph;

        public struc(char Character, char EndGlyph, char IniGlyph,
                char MidGlyph, char IsoGlyph) {
            character = Character;
            endGlyph = EndGlyph;
            iniGlyph = IniGlyph;
            midGlyph = MidGlyph;
            isoGlyph = IsoGlyph;
        }
    }
 

 
 
最新提问 12月 31, 2014 分类:Android 小技巧 | 用户: forlong401 (7,050 分)

1个回答

0 喜欢 0 不喜欢

   

3) And in your Activity:

Typeface tf = Farsi.GetFarsiFont(this);
MyTextView.setTypeface(tf);
MyTextView.setText(Farsi.Convert("سلام"));

 
 
 
 
最新回答 12月 31, 2014 用户: forlong401 (7,050 分)
...