TextUnitTypes

interface TextUnitTypes

用于创建 TextUnitType 实例的工厂接口。

通过此接口可以获取预定义的文本单位类型。

Author

M8Test, [email protected], https://m8test.com

Functions

Link copied to clipboard
abstract fun getEm(): TextUnitType

获取表示“相对字体大小(em)”的 TextUnitType。 "em" 单位是相对于当前字体大小的倍数。例如,1.5.em 表示当前字体大小的 1.5 倍。

Link copied to clipboard
abstract fun getSp(): TextUnitType

获取表示“缩放无关像素(Scale-independent Pixels)”的 TextUnitType。 这是推荐用于指定字体大小的单位,因为它会根据用户的字体大小偏好进行缩放。

Link copied to clipboard

获取表示“未指定”的 TextUnitType。 当文本单位未明确指定时使用,通常表示从父级样式继承。