在 Android 中编写阿拉伯字符
这是我使用的代码 但每次我执行它时都会强制停止。 请注意,我在 android 2.1 上使用它
package com.arb;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import android.content.res.AssetManager;
import android.graphics.Typeface;
public class arabi extends Activity
{
AssetManager arabi_font;
TextView tx;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tx=(TextView) this.findViewById(R.id.tt);
try{
arabi_font.open("DejaVuSans.ttf");
//DejaVuSans.ttf font file
tx.setTypeface(Typeface.createFromAsset(arabi_font,"DejaVuSans.ttf"));
tx.setText("\uFEB3\uFE92\uFE98\uFE94");
}
catch(Exception ex){
}
}
}
This is the code I used
but every time I excute it force to stop.
note that I use it on android 2.1
package com.arb;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import android.content.res.AssetManager;
import android.graphics.Typeface;
public class arabi extends Activity
{
AssetManager arabi_font;
TextView tx;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tx=(TextView) this.findViewById(R.id.tt);
try{
arabi_font.open("DejaVuSans.ttf");
//DejaVuSans.ttf font file
tx.setTypeface(Typeface.createFromAsset(arabi_font,"DejaVuSans.ttf"));
tx.setText("\uFEB3\uFE92\uFE98\uFE94");
}
catch(Exception ex){
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个,我刚刚重新编码了几行,我相信它有效......
Try this, I've just recode several lines, I belive it's working...