How to use specified weights for fonts in XML

后端 未结 9 1996
小蘑菇
小蘑菇 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:34

    Please see the official Android reference for Font Weight Values:

    android:fontWeight

    Integer. The weight of the font. This attribute is used when the font is loaded into the font stack and overrides any weight information in the font's header tables. The attribute value must be a positive number, a multiple of 100, and between 100 and 900, inclusive. If you do not specify the attribute, the app uses the value from the font's header tables. The most common values are 400 for regular weight and 700 for bold weight.

    https://developer.android.com/guide/topics/resources/font-resource

提交回复
热议问题