2016-12-05 119 views

回答

2

您可以使用Style类为Label设置粗体字体和文字修饰。例如:

Font fnt = Font.createTrueTypeFont("abc.ttf", "abc.ttf"). 
     derive(4, Font.STYLE_BOLD); 
/* 
* I set up all styles in this case (Unselected,Selected,Pressed,Disabled),  
* but btw you can edit each style independantly (getUnslectedStyle(),etc...) 
*/ 
myLabel.getAllStyles().setFont(fnt);  //Font Selected 
myLabel.getAllStyles().setUnderline(true); //Text decoration enabled 
+0

正确。我还要提到TTF的创建是不正确的,并且在设备上会失败,在这种情况下,由于权重是从ttf派生的,所以字体权重几乎没有意义。的Roboto-大胆。在开发人员指南的基础部分深入讨论了从代码加载字体的正确方法 –

相关问题