我正在尝试在我的应用中显示阿拉伯语文字(从右到左),但我会在行中从左到右显示单词。
我正在使用阿拉伯语支持字体和阿拉伯语重塑器库。文本从字符串文件加载。
该应用支持Android 2.1。
这里是结果的屏幕截图:
更多详情:
public class MainActivity extends Activity {
private TextView tvtest = null;
private static Typeface typeface;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tvtest = (TextView) findViewById(R.id.tvtest);
tvtest.setText(ArabicUtilities.reshape(getString(R.string.first_part)));
Typeface tf;
tf = GetFont(getApplicationContext());
tvtest.setTypeface(tf);
}
public static final Typeface GetFont(Context context) {
if (typeface == null) {
typeface = Typeface.createFromAsset(context.getAssets(),
// "DroidSansFallback.ttf");
"MSHQW.TTF");
}
return typeface;
}
}
答案 0 :(得分:0)
尝试设置TextView
的重力。
代码:
或XML格式:
android:gravity="..."