Jack K Fouani
12
fonts
android
我的应用程序中有一个API类; 例如,在API类中,有一个自定义字体已设置为静态
public static Typeface font_short;
@SuppressWarnings("deprecation")
public Api(Context c , Display d)
{
this.context = c ;
//I want to change this if user wants to keep using System font style or my custom style
if ( keep_curren == true )
{
font_title = //What to add here to get Default fonts Typeface
}else
//use my costume font
{
font_title = Typeface.createFromAsset(context.getAssets(),"fonts/custome.ttf");
}
display = d;
w = display.getWidth(); // deprecated
h = display.getHeight(); // deprecated
}
如果用户不想使用我的自定义字体,我想获取设备的默认和当前Typeface!
在活动类中
TextView blaaa = (TextView) findViewById(R.id.blaaa);
//change to custome font style or keep current font style
blaaa.setTypeface(Api.font_title);
有任何想法吗?