[英]font -family roboto android 2.3.3
I am trying to use the roboto fonts package for my android 2.3 app, but it does not add the fomarto letter. 我正在尝试为我的android 2.3应用程序使用roboto字体包,但未添加fomarto字母。 I've already tried using this code:
我已经尝试使用以下代码:
TextView tvTextView = ( TextView ) findViewById ( R . id . textView1 );
Typeface typeface = Typeface . createFromAsset ( getAssets (), "Roboto-Black.ttf" );
tvTextView . setTypeface ( typeface );
It does not apply the letter format, how do I rotate the sources roboto android 2.3? 它不应用字母格式,我该如何旋转信号源roboto android 2.3?
Use this TextView instead: 使用此TextView代替:
public class TextView_Roboto extends TextView {
public TextView_Roboto(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
createFont();
}
public TextView_Roboto(Context context, AttributeSet attrs) {
super(context, attrs);
createFont();
}
public TextView_Roboto(Context context) {
super(context);
createFont();
}
public void createFont() {
Typeface font = Typeface.createFromAsset(getContext().getAssets(), "robo_font.ttf");
setTypeface(font);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.