我需要在我的应用中显示印地语和孟加拉语字体支持。怎么做。请帮忙。 还告诉我如何从XML获得支持,因为我需要通过Web服务获取数据。
答案 0 :(得分:0)
我所做的是将特定字体选择到assets文件夹并使用此代码:
public class CustomTextView extends TextView{
public CustomTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
initFont();
}
public CustomTextView(Context context, AttributeSet attrs) {
super(context, attrs);
initFont();
}
public CustomTextView(Context context) {
super(context);
initFont();
}
private void initFont() {
Typeface tf = Typeface.createFromAsset(getContext().getAssets(),"myfont.ttf");
setTypeface(tf);
}
}
但我遇到的问题是,即使我在我的模拟器中获取字体某些字体模式也不正确。
如果有人想在我的回答中添加更多内容,请回复,欢迎您。