How to use specified weights for fonts in XML

后端 未结 9 2010
小蘑菇
小蘑菇 2021-01-30 02:58

Using the Fonts in XML feature you can specify various font weights for a font family. For example:



        
9条回答
  •  面向向阳花
    2021-01-30 03:37

    Since the textFontWeight attribute is API level 28 and higher a workaround for supporting older devices is to create a separate fontFamily for each font-weight and reference the fontFamily from the View.

    res/layout/your_layout.xml

    
    
        
    
    
    

    res/font/fontFamily_your_font_bold.xml

    
    
        
    
    
    

提交回复
热议问题